Reputation: 21
My Django Settings.py like that:
CACHES = {
'default': {
'BACKEND': 'django.core.cache.backends.memcached.PyLibMCCache',
#'LOCATION': os.environ['MEMCACHED']
'LOCATION': "127.0.0.1",
#"BINARY" : True,
},
}
SESSION_SAVE_EVERY_REQUEST = True
SESSION_ENGINE = 'django.contrib.sessions.backends.cache'
SESSION_EXPIRE_AT_BROWSER_CLOSE = True
SESSION_COOKIE_AGE = 0
I store my sessions on memcached. But, the cache expire time allway 300s!!
As django document, they say SESSION_COOKIE_AGE = 0 means never timeout, but it no used for the cache timeout?
So, now i want make the session cache never timeout until browser close?
Do not tell me only set SESSION_EXPIRE_AT_BROWSER_CLOSE, because i store the sessions in memcached, the cache has a expire time too.I want the cache never expire.
Thanks.
Upvotes: 0
Views: 1378
Reputation: 21
I find the reason!
There has CACHES
in Settings.py
.When you use memcached to store the session, and set SESSION_COOKIE_AGE=0
. Django will use the default timeout(300s) for each cache.
If u want the set the cache never timeout, you need add TIMEOUT=0
into CACHES
Upvotes: 1
Reputation: 1951
EDIT : I found this post from 2006 https://groups.google.com/forum/#!topic/django-users/oLZTAAA6wVE Try putting this setting in your app's settings.py.
I think you could put an expiration time very far away (like 2050 for example) and it should work. Try maybe, who knows :p.
Upvotes: 0