I have an azure redis cache. I've set it up so that I can do stringGet key setting based off this example. It works pretty great.
However, I want to know if the cache is empty or not, or if there are any entries of (x) type of a C# object I have. I currently want to see if I can get a key count. I haven't found any solutions for this.
My only idea is to do a key scan that would search for every key (a get all) and then do a count. But that seems inefficient. Is there a more "meta" data style solution?
Thanks!
Per my understanding, you could leverage
IServer.Keys
to retrieve all keys with matching pattern as follows:For more details about keys scanning, you could refer to this tutorial.