Question : cache-control no cache django
Answered by : federico-mercalli
from django.views.decorators.cache import never_cache
@never_cache
def myview(request): # ...
Source : https://stackoverflow.com/questions/2095520/fighting-client-side-caching-in-django | Last Update : Wed, 05 May 21
Question : cache in django
Answered by : nervous-narwhal-0kqkz73xvnem
class CacheRouter: """A router to control all database cache operations""" def db_for_read(self, model, **hints): "All cache read operations go to the replica" if model._meta.app_label == 'django_cache': return 'cache_replica' return None def db_for_write(self, model, **hints): "All cache write operations go to primary" if model._meta.app_label == 'django_cache': return 'cache_primary' return None def allow_migrate(self, db, app_label, model_name=None, **hints): "Only install the cache model on primary" if app_label == 'django_cache': return db == 'cache_primary' return None
Source : https://docs.djangoproject.com/en/3.2/topics/cache/ | Last Update : Mon, 19 Apr 21