[web2py] Re: How do you change memcache session expiry?
Yes, I agree. This needs to be REMOVED FROM THE BOOK. I've just wasted most of a day before realizing memcache is useless for sessions. -- Joe On Friday, January 18, 2013 at 1:03:01 AM UTC-8, Paolo wrote: > > 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=) >>> >>> 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 . We default to 0 == cache forever >>> . >>> >>> Are you saying that doesn't work? >>> >>> -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: How do you change memcache session expiry?
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? --
[web2py] Re: How do you change memcache session expiry?
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? --
[web2py] Re: How do you change memcache session expiry?
Ah, I understand what you're saying. I can't seem to find a way to do this either - if it is obvious it is escaping me too. Perhaps consider opening an issue as a feature request or even possibly a bug - it is a common enough thing to want to do with sessions. --
[web2py] Re: How do you change memcache session expiry?
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? --
[web2py] Re: How do you change memcache session expiry?
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? --
[web2py] Re: How do you change memcache session expiry?
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? --
[web2py] Re: How do you change memcache session expiry?
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? --
[web2py] Re: How do you change memcache session expiry?
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? --