Can I group the Memcached keys so that I can flush a group but the total Memcached

921 Views Asked by At

I use Memcached to store content lists with very key combinations, when user edited the content, I must refresh the cache, but it is hard to say what particular list to refresh, it is not either a good idea to flush the entire Memcached server, so my question is: Can I group the Memcached keys so that I can flush a group but the total Memcached?

2

There are 2 best solutions below

0
Sascha Trifunovic On BEST ANSWER

Memcached does not have support for range queries so unfortunately you cannot flush a subset of keys.

0
Igor On

Memcached does not natively support flushing of the cache group. What you could try is to group your Memcached keys in namespaces. Check the Memcached wiki for more information.

If by any chance you're using Spring Boot you could try the auto-configuration library for the Memcached cache. The library supports clearing out of the cache group.