I want memcached to be flushed on every restart/reload of django server. I use cherrypy for production and builtin server for development.
I would add this to settin
If you have multiple cache backends, django.core.cache.cache.clear() will only clear the default cache. To make sure your clear_cache command clears cache from all your backends, you should use the following command:
from django.conf import settings
from django.core.cache import caches
from django.core.management.base import BaseCommand
class Command(BaseCommand):
help = "Clear cache"
def handle(self, **options):
for k in settings.CACHES.keys():
caches[k].clear()
self.stdout.write("Cleared cache '{}'.\n".format(k))