Excellent. Thank for the example.
Questions:
1. I assume not, but want to ask: is there anything special about the
attribute '_cache' you've added to the session object? I could add
any such attribute?
2. Will this work fine with scoped sessions? (these objects aren't
recycled are they?)
On Mar 22, 2010, at 9:48 AM, Michael Bayer <mike...@zzzcomputing.com>
wrote:
On Mar 22, 2010, at 9:06 AM, Kent wrote:
I have a need to pass around session-dependent application data, such
as strong references to certain objects that I don't want garbage
collected so they will serve as a cache for the duration of the
session. For example, if the application performs a get() on a
"SystemParameters" table, I want a strong reference to that object
for
the duration of the session so that subsequent get()s do not
reference
the database.
Further, I don't wish to pass such a variable all over through-out my
session to all function calls, etc.
I was considering adding an attribute to the (scoped) session for
this
purpose at run time (I wish to avoid modifying the thirdparty
source). Something that will automatically be torn down when the
(scoped) session is.
Can you recommend an approach or better idea?
subclass Query and setup caching options. There's examples in
the 0.6 distro that use Beaker including one that assigns the cache
to be local to the Session, but attached is a simpler version from
my pycon tutorial that doesn't have any dependencies.
Thanks very much again.
--
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
.
<query_subclass.py>
--
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.