Getting all keys from NCache Server

1.4k Views Asked by At

We are thinking about to use NCache from alachisoft.

Does it have a method to get all keys and values ?

We are trying to understand how we can do it?

Redis has this kind of feature, does Ncache miss this feature ?

2

There are 2 best solutions below

1
On
0
On

Does it have a method to get all keys and values? The answer is YESSS!

There are two ways to do it.

  1. NCache has a method GetEnumerator() which traverse through all keys present in cache.

  2. NCache's Cache class is a key-value pair object, so you can loop through all keys using foreach loop like;

    foreach (string key in _cache) // _cache is an object of 'Cache' class.
    {
        object value = _cache.Get(key);
        // do whatever you want do further.....
    }
    

Regards....