redis session patch, thanks Niphlod
This commit is contained in:
@@ -1 +1 @@
|
|||||||
Version 2.1.0 (2012-10-13 09:25:28) dev
|
Version 2.1.0 (2012-10-13 09:26:50) dev
|
||||||
|
|||||||
@@ -19,8 +19,8 @@ locker = thread.allocate_lock()
|
|||||||
def RedisSession(*args, **vars):
|
def RedisSession(*args, **vars):
|
||||||
"""
|
"""
|
||||||
Usage example: put in models
|
Usage example: put in models
|
||||||
|
from gluon.contrib.redis_session import RedisSession
|
||||||
sessiondb = RedisSession('localhost:6379',db=0, debug=True)
|
sessiondb = RedisSession('localhost:6379',db=0, session_expiry=False)
|
||||||
session.connect(request, response, db = sessiondb)
|
session.connect(request, response, db = sessiondb)
|
||||||
|
|
||||||
Simple slip-in storage for session
|
Simple slip-in storage for session
|
||||||
@@ -180,7 +180,10 @@ class MockQuery(object):
|
|||||||
def update(self, **kwargs):
|
def update(self, **kwargs):
|
||||||
#means that the session has been found and needs an update
|
#means that the session has been found and needs an update
|
||||||
if self.op == 'eq' and self.field == 'id' and self.value:
|
if self.op == 'eq' and self.field == 'id' and self.value:
|
||||||
return self.db.hmset("%s:%s" % (self.keyprefix, self.value), kwargs)
|
rtn = self.db.hmset("%s:%s" % (self.keyprefix, self.value), kwargs)
|
||||||
|
if self.session_expiry:
|
||||||
|
self.db.expire(key, self.session.expiry)
|
||||||
|
return rtn
|
||||||
|
|
||||||
class RecordDeleter(object):
|
class RecordDeleter(object):
|
||||||
"""Dumb record deleter to support sessions2trash.py"""
|
"""Dumb record deleter to support sessions2trash.py"""
|
||||||
|
|||||||
Reference in New Issue
Block a user