CACHE_MIDDLEWARE_ANONYMOUS_ONLY
is removed in Django 1.8
Instead, the headers can be used and, more specifically, the vary_on_cookie
decorator.
This means that a separate cache is stored according to each user's cookie.
The recorded users have a cookie, not logins, so different caches are created for each cookie session. The following is my implementation.
urls.py
entry:
from django.views.decorators.vary import vary_on_cookie from django.views.decorators.cache import cache_page ... url( r'^$', cache_page(60 * 1440, cache='disk')(vary_on_cookie(MyCbvView.as_view())), name='view-name', ), ...
source share