AFAIK the session is sort of a first-level-cache, that is valid until the session is valid. A new session builds up a new first-level-cache.
I think what you need is a second level cache that caches globally for all sessions. Is there something built in into SA, or do you support your own cache, like a global dict? Alex. On 8/8/06, Julien Cigar <[EMAIL PROTECTED]> wrote: > Yep I'm doing something like this too at the moment, but it's a bit a > pity to not use the persistent/caching functionality of the SQLAlchemy > sessions and every time reload data (objects) from the database, even if > they haven't changed ... > > I made some basic tests with memcached and it *seems* to work ... > > Regards, > Julien > > Alex Greif wrote: > > Hi Julien, > > > > I also use mod_python in the following way: > > my handler that is decorated with my decorator: @orm_persistent > > that opens a session and eicher in finally or tin the except block > > always closes the session, so I can always be sure not to forget to > > close a session. > > Of cource I can forget the decorator itself ;-) > > > > For sharing the session object between the apache processes I have not > > Idea. > > But if it is the same thread you could use threadlocal. > > > > Alex. > > > > On 8/8/06, Julien Cigar <[EMAIL PROTECTED]> wrote: > >> Hello list, > >> > >> I'm using SQLAlchemy with apache/mod_python (prefork) and a custom > >> mod_python handler. I was looking for a solution to share the session > >> object between the apache processes. > >> > >> At the moment I have a session object per process (which work fine), but > >> I have to close / reopen the session object for each request which is > >> not optimal ... and can cause a lot of problems if I forget to close the > >> session at the end of a request, for example if I modify an object in > >> the session of a process which is still persistent (cached) in the > >> session of another process, etc ... > >> > >> I plan to use either shared memory (no experience with this at the > >> moment) or memcached which look nice. Do you have any suggestion or > >> another solution for this ? > >> > >> Thanks, > >> Julien > >> > >> ------------------------------------------------------------------------- > >> > >> Using Tomcat but need to do more? Need to support web services, > >> security? > >> Get stuff done quickly with pre-integrated technology to make your > >> job easier > >> Download IBM WebSphere Application Server v.1.0.1 based on Apache > >> Geronimo > >> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > >> _______________________________________________ > >> Sqlalchemy-users mailing list > >> Sqlalchemy-users@lists.sourceforge.net > >> https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users > >> > > ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ Sqlalchemy-users mailing list Sqlalchemy-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users