This thread had the same topic: http://groups.google.com/group/web2py/browse_thread/thread/b587b14f451da0f8/
and resulted in the same problems using sqlite:memory: :) Robin B suggested a 'RAMDB': > No one has published a 'RAMDB' (a DAL driver for RAM). It could > easily be implemented as a global dict, and it could be useful for say > caching, but I would not put sessions into ram for production. If you > have more than 1 application server/process, you will not be able to > share sessions between them. RAMDB would however be very useful for > development. :) > > Robin Markus On Mon, Apr 6, 2009 at 6:14 AM, Iceberg <iceb...@21cn.com> wrote: > > Hi, does anyone know, is there a way to store session in memory? Even > this means sessions will be lost if web2py restarts, but that is fine > for some non-critical apps. Besides, this way we don't need to worry > about cleaning up the old sessions anymore. And perhaps slightly > faster. > > I have tried these in models/db.py but failed. > > (1) > db=SQLDB('sqlite:memory:') # Actually here we get a new empty db > everytime > session.connect(request,response,db=db) # So sessions in last mem db > can not bring to next click. > > (2) > db=cache.ram('sqlmem',lambda:SQLDB('sqlite:memory:'),3600) > session.connect(request, response, db=db) > # It is tricky but doesn't work. Because this way sqlite complains > multi thread accessing one db instance. > > (3) > Actually I tried some more complicated code, trying to backup raw > session data in cache.ram, and read them back into a new empty sqlite > memory db. It almost works, but I don't know when I shall do the > backup. The current session data seems not exist yet when the db.py is > executing? > > Thanks in advance. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "web2py Web Framework" group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~----------~----~----~----~------~----~------~--~---