pip install django-cache-machine
python
CACHES = {
'default': {
'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
'LOCATION': '127.0.0.1:11211',
}
}
python
from django_cache_machine.models import CacheMachineMixin
class YourModel(CacheMachineMixin, models.Model):
python
YourModel.objects.all()
python
YourModel.objects.clear_cache()