aspnet/Caching

Flushing the cache

kimbell opened this issue · 1 comments

In some cases there is a need to remove all the entries from the cache. e.g. you are caching data that contains wrong information. One way to achieve this is to restart the application; not ideal.

The better approach would be to have some API that allows you to achieve this.

The MemoryCache class maintains a ConcurrentDictionary over all the items. Exposing this through the IMemoryCache would be a breaking change, so not something we want to do.
An extension method that has access to internals seems to be the most compatible approach.

For distributed caches, the story may be different.

Any thoughts on this type of scenario?