Getting or deleting cache entries in Flask with the key starting with (or containing) a substring Getting or deleting cache entries in Flask with the key starting with (or containing) a substring flask flask

Getting or deleting cache entries in Flask with the key starting with (or containing) a substring


It's not supported because Memcache is designed to be a distributed hash. There's no index of keys stored to search in.

Ideally you should know what suffixes a key may have.If not, you could maintain an index yourself in a special key for the user.Like user_id + '_keys' which contains a list of keys.This way you can cycle key by key and delete all the cache for the user.

You can override the .set function to manage this new key.