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: 2 comments 2 replies
-
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.
-
Can someone help me understand what is the maximum allowed length for cache keys in Fusion Cache when using Redis-based distributed caches (such as Redis Server, Azure Redis, or Garnet) as the L2 backend? I am planning to enforce key length constraints in my applications to ensure compatibility and performance across different environments. While Fusion Cache documentation does not explicitly mention a key length limit (I have searched, but did not find it), I would like to understand any practical or recommended limits - especially considering the underlying distributed cache systems. Are there any guidelines or restrictions I should follow to avoid issues with key storage or retrieval? I will keep all the key lengths to some reasonable limit, but if there is any upper limit (Bytes, Length,...etc.) for the keys, this would be helpful. |
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.