We used a own middleware, because we don't want to vary on cookies and don't want cache the cookies. This is very ineffective. See also discussion on django-developers group: The state of per-site/per-view middleware caching in Django
Ower own solution is very fast, but has also some disadvantage, see:
We must distinguish between the language of the content and the language of gettext (the 'source code translations').
We can't serve the content and the gettext in different languages, because both are stored with the same cache keys (the current url).
Important is, that the cache should not shared between:
See also discussion on django-developers group:
There are a few solutions to separate the caches: Add username/SITE_ID to:
We do this by adding Username and SITE_ID to cache backend location. See also: local_settings.py example
We add some information to a simple dict to cache something. e.g.: urls from PageTree/PageMeta
Such caches are very effective, but has problems in multi-threaded environments.
We used a solution from django-tools: Local sync cache