0

I have set up memcached in Django using Pylibmc binding:

CACHES = {
    'default': {
        'BACKEND': 'django.core.cache.backends.memcached.PyLibMCCache',
        'LOCATION': ['10.241.1.1:11211',
                    '10.241.1.2:11211',]
    }
}

I tested on server with django shell, and the memcached pool workse for getting and setting values in memcached. But when I try to set

SESSION_ENGINE = "django.contrib.sessions.backends.cached_db"   OR
SESSION_ENGINE = "django.contrib.sessions.backends.cache"

my website can still be accessed, but halts when user pressed login button. So I guess this must be the problem with session backend. My website works fine by using database as session backend. I cannot find any related error in apache or website error log, and /var/log/memcached.log is empty.

Reference: https://docs.djangoproject.com/en/1.1/topics/http/sessions/

0

I guess this is a bug of Pylibmc, although the reason of the bug is still unknown. The weired thing is that when I tried the same code in management/commands/, it works just fine. But I can't even cache.set(key, value) in views, which will cause the page to halt.

So I switched back to python-memcached, and it works.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.