Can I iterate over the .NET4 MemoryCache?

后端 未结 3 687
梦毁少年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:08

    In 2014,

    This is the correct way to get all the items:

    Dim AllItems = MemoryCache.Default.Select(Of ItemType)(Function(O) O.Value)

    Hope this helps someone.

提交回复
热议问题