Adding Items with an Absolute Expiration Policy

When you insert items in the cache, you can specify a time when the items expire. If you want an item to remain in the cache for an extended period of time, you should always specify an expiration time for the item.

The page in Listing 29.36 illustrates how you can add an item to the cache with an absolute expiration policy. The item is added to the cache for 1 hour.

Listing 29.36. ShowAbsoluteExpiration.aspx

images

images

The first time the page in Listing 29.36 is requested, nothing is retrieved from the cache. ...

Get ASP.NET 4 Unleashed now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.