caching is a really ambiguous endeavor, if you can lay out your
requirements more specifically that would help (specifically, whats
the lifecycle of a cached object, and what scenarios are you trying
to optimize ?  i.e. do you have expensive SQL, etc.)

I'm trying to create a distributed cache for *all* objects. I want to check that cache first before creating the object from the database. So the lifecycle of a cached object is until one of the servers makes any persistent change to the object.


I have a concept worked out that seems to do well enough, but unfortunately it means not using any of SA's relations. I have my own Join objects that are cached. if a cached version doesn't exist, the Join object can generate an sql query to get the list of ids out of the database. The join object holds on to only those ids, and when __getitem__ is called, the Join object checks the cache for the requested object, and then hits the db. The life cycle of the Join object in the cache is until some persistent attribute is changed (or a new object is created) that would cause the Join to render different results. I only have this functionality working with simple single, multiple, and related joins.


That aside and more importantly, I'm still having some issues with more basic stuff. That is, I can't get a handle on how to use expunge and update properly. When I pickle an object to a file or memcache (before or after expunging it), the _state attribute doesn't go along with it, nor does any persistent attribute that hasn't been changed from the default of None. Because of this, update fails when it tries to access _state on the unpickled version. I was originally unaware of this because the process works out fine if I unpickle the item in the same python instance where I pickled it -- the object has _state and all the other attributes.



-Michael
-------------------------------------------------------------------------
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

Reply via email to