Sams Teach Yourself ASP.NET in 21 Days, Second Edition By Chris Payne
Table of Contents
Day 14. Using ASP.NET's Improved Caching Capabilities
This workshop will help reinforce the concepts you've learned in today's lesson. Answers can be found in Appendix A.
Quiz
1:
What's the difference between server-side and client-side caching?
2:
Which caching mechanism stores cached data on the computer's hard drive?
3:
What are the pros and cons of using the Cache class instead of output caching?
4:
What's the difference between the SetExpires method and the SetMaxAge method of the Response.Cache object?
5:
What's the full signature of the Cache.Add method?
6:
Suppose you have a page that accepts the following querystring parameters: userid, searchstring, pagenumber, and orderby. Using VaryByParams, which items should you cache by, and what's the required code?
Exercises
[click here]
Using Listing 14.5 as the basis for your testing, measure the performance benefit of retrieving the DataView from the cache instead of creating it explicitly. (Hint: use the Ticks property of the DateTime instance to return a small measure of time 100-nanosecond blocks, or 1-ten-millionth of a second.) Discuss the difference in time.