Cache Control - Keys #127
-
Sorry if this is documented somewhere and I couldn't find it but is there a way to get all keys in the cache, or get all keys by some sort of filter? The use case here from my side is I batch load data and on a new load I would like to go into the cache and clear any key that matches a certain pattern. I know there is a proposal for a share token to do this now, but my need in this area would be much simpler with something like a get and remove. Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Hi @timothyeckert and thanks for using FusionCache! It's not possible to access all the keys in the cache, because FusionCache is based on the common Even more so when using a 2nd level (distributed cache, like Redis), enumerating keys is something that is typically avoided, and in some cases even completely disabled, like on Azure Redis Cache. |
Beta Was this translation helpful? Give feedback.
Hi @timothyeckert and thanks for using FusionCache!
It's not possible to access all the keys in the cache, because FusionCache is based on the common
IMemoryCache
andIDistributedCache
interfaces, so we are limited to only the methods available there.Even more so when using a 2nd level (distributed cache, like Redis), enumerating keys is something that is typically avoided, and in some cases even completely disabled, like on Azure Redis Cache.