Hi all, I have just tried the solution proposed on the issue but it doen't work. This is a really annoying bug not only because I have to login several times in a day but also because I can lose my edits if I don't save my changes in time (i.e, editing a wiki page). It might be better to remove from the book the advise of storing the session in memcached unless we find a solution
Paolo Il giorno domenica 30 settembre 2012 00:54:03 UTC+2, Robert Clark ha scritto: > > Thanks everyone, have added an issue > http://code.google.com/p/web2py/issues/detail?id=1049 > > On Sunday, September 30, 2012 3:51:10 AM UTC+13, Massimo Di Pierro wrote: >> >> It also looks to me memdb should not be implemented as it is. It should >> be implemented as a plugin_adapter for DAL. >> >> On Saturday, 29 September 2012 09:50:37 UTC-5, Massimo Di Pierro wrote: >>> >>> 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? >>>>>> >>>>>> --