﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
30072	get_current cache uses global variable instead of cache breaking multiple instance deployments.	Luke Seelenbinder	nobody	"I use the Sites framework extensively with a multiple instances of the application server deployment of Django. Because the sites framework uses a global to cache the current site, any update ''only'' affects whichever application server handled the update, leaving the outdated information cached on any other application servers.

I would patch it to use the Django caching system instead of a global, but I'm not sure if that's the correct way to go about it.

Relevant code: https://github.com/django/django/blob/master/django/contrib/sites/models.py#L103


{{{
#!python
def clear_site_cache(sender, **kwargs):
    """"""
    Clear the cache (if primed) each time a site is saved or deleted.
    """"""
    instance = kwargs['instance']
    using = kwargs['using']
    try:
        del SITE_CACHE[instance.pk]
    except KeyError:
        pass
    try:
        del SITE_CACHE[Site.objects.using(using).get(pk=instance.pk).domain]
    except (KeyError, Site.DoesNotExist):
        pass
}}}

"	Bug	new	contrib.sites	2.1	Normal				Unreviewed	0	0	0	0	0	0
