[Fixed]-Can't delete cache for specific entry in Django

3👍

cache.set(key, None, 0) should be enough, I’ve been clearing cache keys that way before.

If you are able to, can you try the cache.clear(), to clear it all? Just to see if it works.

Are non of your cache keys deletable? Is the output of this as expected?

cache.set('testkey', 'testvalue', 600)
cache.get('testkey')
cache.delete('testkey')
cache.get('testkey')
cache.set('testkey', 'testvalue2', 600)
cache.set('testkey', 'another value', 600)
cache.get('testkey')

And have you tried with another caching backend? It looks like everything you are doing is correct.

Maybe the error is in the backend, some configuration that wont let it overwrite keys or something weird..

👤xeor

Leave a comment