pip install django-cache-machine
python
CACHES = {
'default': {
'BACKEND': 'cachemachine.backends.CMCache',
'LOCATION': 'cachemachine://',
}
}
INSTALLED_APPS = [
...
'cachemachine',
...
]
CACHE_MACHINE_ENABLED = True
python
from django.db import models
from cachemachine.decorators import cached
@cached
class MyModel(models.Model):
...
python
CACHES = {
'default': {
'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
'LOCATION': '127.0.0.1:11211',
}
}
python
CACHE_MACHINE_CACHE_SECONDS = 60