I would prefer the syntax:

session.connect(request, response, db=MEMDB(cache.memcache, 
session_expiry=3600))



On Saturday, 29 September 2012 07:11:10 UTC-5, Niphlod wrote:
>
> yep, open a bug on http://code.google.com/p/web2py/issues/list
>
> On Saturday, September 29, 2012 5:24:07 AM UTC+2, Robert Clark wrote:
>>
>> Thanks, I am not having any problems with the memcached api & python 
>> interface, that part all works as advertised.
>>
>> The problem is that if you follow the deployment recipe for storing 
>> sessions in Memcached, then they always expire after 300s and there's no 
>> way to provide an expiry.  Here's what's the code from deployment recipe 
>> chapter of web2py book:
>>
>> from gluon.contrib.memcache import MemcacheClientmemcache_servers = 
>> ['127.0.0.1:11211']
>> cache.memcache = MemcacheClient(request, memcache_servers)
>> cache.ram = cache.disk = cache.memcache
>>
>> ..and..
>>
>> from gluon.contrib.memdb import MEMDB
>> session.connect(request,response,db=MEMDB(cache.memcache))
>>
>>
>> If you do this and connect to memcached with e.g. "-vv" you can see that 
>> session data is passed in with 300s expiry.  I may be missing something 
>> obvious.  Can I suggest altering the API to be something like this:
>>
>> session.connect(request, response, db=MEMDB(cache.memcache), 
>> session_expiry=3600)
>>
>> Thanks!
>>
>>
>> On Saturday, September 29, 2012 12:27:55 AM UTC+12, Jose C wrote:
>>>
>>> The only way I've found to change this is to explicitly modify the 
>>>> default value from this source file.
>>>>
>>>> Is there a better way to configure this value for session expiry from 
>>>> within application code?  Cheers.
>>>>
>>>> Far as I know it's done like this:  
>>>
>>> set(key=key, value=value, time=<seconds>) 
>>>
>>> where (from the source):
>>> @param time: Tells memcached the time which this value should expire,either
>>>         as a delta number of seconds, or an absolute unix time-since-the
>>> -epoch
>>>         value. See the memcached protocol docs section "Storage 
>>> Commands"
>>>         for more info on <exptime>. We default to 0 == cache forever.
>>>
>>>  Are you saying that doesn't work?
>>>
>>>

-- 



Reply via email to