cache middleware on multi sites...

62 views
Skip to first unread message

jedie

unread,
Nov 19, 2009, 6:16:52 AM11/19/09
to Django developers
There exist some "intersection" on multi site installation, if i use
django.middleware.cache.UpdateCacheMiddleware and
django.middleware.cache.FetchFromCacheMiddleware

Problem:
The cache key would be only generated based on the url without the
domain name. So if the page /foobar/ exist on site A and site B but
with different content, they would be only caches one time.

Solutions:
1. The user can insert this into his settings:
CACHE_MIDDLEWARE_KEY_PREFIX = "FooBar %s" % SITE_ID

2. Django should insert the SITE_ID into cache key. e.g. in
django.utils.cache.get_cache_key()

3. Django should use the complete path to build the cache key. e.g.:
use request.build_absolute_uri() in
django.utils.cache._generate_cache_header_key() instead of iri_to_uri
(request.path)

Mfg.

Jens Diemer

Reply all
Reply to author
Forward
0 new messages