1 2 3 4 5 6 7 8 9 10 11 12 | from django.core.cache import cache
try:
cache._cache.clear() # in-memory caching
except AttributeError:
# try filesystem caching next
old = cache._cull_frequency
old_max = cache._max_entries
cache._max_entries = 0
cache._cull_frequency = 1
cache._cull()
cache._cull_frequency = old
cache._max_entries = old_max
|
More like this
- Expire page from cache by mattgrayson 3 years, 6 months ago
- Template tag to clear cached template fragment by joao.coelho 2 years, 2 months ago
- cleat_list by Tomek 1 year, 1 month ago
- clear session table by rubic 4 years, 11 months ago
- Cache Decorator by ericmoritz 3 years, 2 months ago
Comments
At least for locmem one has to do clear also "_expire_info", otherwise there will be key errors:
#
if you're using memcached it's
#