.NET 4 ObjectCache - Can We Hook Into a "Cache Expired" Event?

There's a property on the CacheItemPolicy called RemovedCallback which is of type: CacheEntryRemovedCallback. Not sure why they didn't go the standard event route, but that should do what you need.

http://msdn.microsoft.com/en-us/library/system.runtime.caching.cacheitempolicy.removedcallback.aspx


Late to the party with this one but I've just noticed an interesting difference between CacheItemUpdate and CacheItemRemove callbacks.

http://msdn.microsoft.com/en-us/library/system.web.caching.cacheitemupdatereason.aspx

In particular this comment:

Unlike the CacheItemRemovedReason enumeration, this enumeration does not include the Removed or Underused values. Updateable cache items are not removable and can thus never be automatically removed by ASP.NET even if there is a need to free memory.