Reputation: 208
I am working on django-project ,I want to reduce database request overhead. So I am trying with django-cache (Requires Memcached)
vi /etc/sysconfig/memcached
PORT="11211"
USER="memcached"
MAXCONN="1024"
CACHESIZE="64" We increased memory size up to 256
OPTIONS="" added IP address "-l 127.0.0.1"
Changes settings as follows in project:Added new variable in settings.py
CACHE_BACKEND='memcached://localhost:11211'
SESSION_ENGINE = 'django.contrib.sessions.backends.cache'
[ Note : restart memcached: /etc/init.d/memcached restart]
Project is working, It reduces the database request overhead: but that brings certain issues: I lost my session after few time. So I need to login again in application,how can I handle this,I want to store only session details.
Upvotes: 2
Views: 692
Reputation: 170846
You are using it correctly but keep in mind that if you restart memcached, you will loose all your existing sessions. That's to be expected.
Upvotes: 1