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

前端 未结 3 1970
轮回少年
轮回少年 2021-02-12 23:47

I\'ve got a simple object being cached like this:

_myCache.Add(someKey, someObj, policy);

Where _myCache is declared as Obje

3条回答
  •  盖世英雄少女心
    2021-02-13 00:40

    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.

提交回复
热议问题