If you add an item using the indexer, like this:
Cache["TestItem"] = value;
The item is added to the cache with no expiration policy and a normal priority. As a result, the item will stick around indefinitely.
We can help the cache decide which items to toss out of memory by specifying an expiration policy and/or a priority:
Cache.Insert("TestItem", value, null, Cache.NoAbsoluteExpiration,
TimeSpan.FromMinutes(20), CacheItemPriority.Normal, null)
Above, I gave the item a 20 minute sliding expiration. This means each time the item is accessed, its 20 minute lease on life is renewed.
I could have told it to expire after ...