On Aug 25, 2010, at 9:37 AM, Nikolaj wrote:

> Hello,
> 
> I'm struggling to use the Beaker caching example in my project.
> Accessing any attribute on an instance from cache triggers a load from
> database of the instance - even trying to read the primary key!

that means the instances that you're putting in the cache are expired, or at 
least those attributes you are attempting to read.    The beaker example takes 
the objects from a result and sends them straight to the cache, but does not 
detach them from the current session.  Therefore, if your backend is the 
"memory" backend, the objects in the cache are the same as those in your 
current session and they'll get expired when the session is committed or rolled 
back.   

There's not a really spectacular way to get around that except to not use the 
"memory" backend, use one that pickles like memcached (well, pretty much 
memcached is the only backend I'd ever use, but the file/dbm file backends 
would work here too).




> 
> The beaker_caching example runs just fine on my system and doesn't
> exhibit the same problems, although that's on SQLite and without
> Pylons. I traced through the calls to session._merge and prop.merge
> without luck, it seems to run through the column properties and merge
> as expected.
> 
> How do I diagnose this, short of tearing my entire codebase apart? Are
> there any instance state attributes I could inspect to see where the
> merge is going wrong?
> 
> N
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "sqlalchemy" group.
> To post to this group, send email to sqlalch...@googlegroups.com.
> To unsubscribe from this group, send email to 
> sqlalchemy+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/sqlalchemy?hl=en.
> 

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalch...@googlegroups.com.
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.

Reply via email to