October 2010
Intermediate to advanced
1920 pages
73h 55m
English
When you specify a sliding expiration policy, items remain in the cache just as long as they continue to be requested within a specified interval of time. For example, if you specify a sliding expiration policy of 5 minutes, the item remains in the Cache just as long as no more than 5 minutes pass without the item being requested.
Using a sliding expiration policy makes sense when you have too many items to add to the cache. A sliding expiration policy keeps the most requested items in memory and the remaining items are dropped from memory automatically.
The page in Listing 29.37 illustrates how you can add a DataSet to the cache with a sliding expiration policy of 5 minutes.
Listing 29.37. ShowSlidingExpiration.aspx ...