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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.