On Wed, Mar 4, 2009 at 3:51 PM, Robin B <[email protected]> wrote:
>
> I have been using MEMDB to store sessions in memcache since August
> 2008:
> http://groups.google.com/group/web2py/browse_thread/thread/cd89f11de4d23b53/f67faac66a695ca2?hl=en&lnk=gst&q=memdb#f67faac66a695ca2
>
> the code is under contrib:
>
> from gluon.contrib.memdb import *
> from google.appengine.api.memcache import Client
> session.connect(request,response,db=MEMDB(Client()))

Wow!  I didn't know about this.  This should probably be in den
scaffolding db.py file.

One question: When does this cache expire?

BTW, I tried it like you suggested:

try:
    from gluon.contrib.gql import *
except:
    db=SQLDB('sqlite://storage.db')
else:
    db=GQLDB()
    from gluon.contrib.memdb import *
    from google.appengine.api.memcache import Client
    session.connect(request, response, db=MEMDB(Client()))

db.define_table('key',
                SQLField('now', 'datetime'),
                SQLField('line', 'text'))

which fails because importing * from gluon.contrib.memdb overwrites
SQLField already defined in gluon.contrib.gql.  I changed it to

from gluon.contrib.memdb import MEMDB

and it seems to work fine.

Kind regards,
Markus

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to