Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In Django, how to clear all the memcached keys and values?

Tags:

I don't want to restart the memcached server!

like image 503
TIMEX Avatar asked Oct 25 '09 05:10

TIMEX


People also ask

What is cache Control in Django?

To use cache in Django, first thing to do is to set up where the cache will stay. The cache framework offers different possibilities - cache can be saved in database, on file system or directly in memory. Setting is done in the settings.py file of your project.

What is default caching mechanism in Django?

Unless we explicitly specify another caching method in our settings file, Django defaults to local memory caching. As its name implies, this method stores cached data in RAM on the machine where Django is running. Local memory caching is fast, responsive, and thread-safe.

What is the default timeout value of Cache_backend in seconds Django?

CACHE_BACKEND Arguments timeout : The default timeout, in seconds, to use for the cache. This argument defaults to 300 seconds (5 minutes).


1 Answers

from django.core.cache import cache cache._cache.flush_all() 

Also see this ticket, it has a patch (that I haven't tested) to flush any type of cache backend: http://code.djangoproject.com/ticket/11503

like image 55
shanyu Avatar answered Oct 14 '22 19:10

shanyu