Can I iterate over the .NET4 MemoryCache?

后端 未结 3 688
梦毁少年i
梦毁少年i 2021-02-18 21:01

I\'m using the cache provided by System.Runtime.Caching.MemoryCache.

I\'d like to enumerate over the cache\'s items so that I can invalidate (evict then rel

3条回答
  •  别那么骄傲
    2021-02-18 22:05

    Consider using ChangeMonitors, which allow you to automatically evict stale entries when certain conditions are met.

    See Is there some sort of CacheDependency in System.Runtime.Caching?

    This is similar to System.Web.Caching CacheDependencys, who allow you to evict entries when files or other cache entries change.

提交回复
热议问题