Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

What is wrong with this cache setup?

I have a problem with memcached setup. When i visit some pages anonymously everything works as expected, but after logging in all the previously visited pages looks like before authentication. This happens for example with /questions and the /users page. (I'm using ldap authentication, not sure if it has anything to do with this problem)

After clearing the cache by hand like this:

python manage.py shell
>>> from django.core.cache import cache
>>> cache.clear()

everything works perfectly.

here is the caching related part from my settings.py:

MIDDLEWARE_CLASSES = (
    ...
    'django.middleware.cache.UpdateCacheMiddleware',
    'django.middleware.common.CommonMiddleware',
    'django.middleware.cache.FetchFromCacheMiddleware',
    ...
)

CACHES = {
    'default': {
            'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
            'LOCATION': '127.0.0.1:11211',
            'TIMEOUT': 60,
            'KEY_PREFIX': 'askbot',
    }
}

CACHE_MIDDLEWARE_ANONYMOUS_ONLY = True

The intresting thing that even the 60 second cache period is over, I still get this pages from cache and the sign out link doesn't show up on top of the page.

some version numbers: askbot: 0.7.53, Python 2.6.6, Memcached 1.4.4, RedHatEnterpriseServer 6.5

What is wrong with this cache setup?

I have a problem with memcached setup. When i visit some pages anonymously everything works as expected, but after logging in all the previously visited pages looks like before authentication. This happens for example with /questions and the /users page. (I'm using ldap authentication, not sure if it has anything to do with this problem)

After clearing the cache by hand like this:

python manage.py shell
>>> from django.core.cache import cache
>>> cache.clear()

everything works perfectly.

here is the caching related part from my settings.py:

MIDDLEWARE_CLASSES = (
    ...
    'django.middleware.cache.UpdateCacheMiddleware',
    'django.middleware.common.CommonMiddleware',
    'django.middleware.cache.FetchFromCacheMiddleware',
    ...
)

CACHES = {
    'default': {
            'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
            'LOCATION': '127.0.0.1:11211',
            'TIMEOUT': 60,
            'KEY_PREFIX': 'askbot',
    }
}

CACHE_MIDDLEWARE_ANONYMOUS_ONLY = True

The intresting thing that even the 60 second cache period is over, I still get this pages from cache and the sign out link doesn't show up on top of the page.

some version numbers: askbot: 0.7.53, Python 2.6.6, Memcached 1.4.4, RedHatEnterpriseServer 6.5