summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2010-08-27 12:32:20 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2010-08-27 12:32:20 -0400
commit89d43fb86ba57374707da97d05cfcedbdb957b00 (patch)
treee6176faade66ae7dc05002cabd77638e73a92402 /examples
parent65a6e97906802237228ea359f33bb33f1ad4a2f9 (diff)
parentaf9fd453c08aac4f4e45f6f6ba94da89b42afe54 (diff)
downloadsqlalchemy-89d43fb86ba57374707da97d05cfcedbdb957b00.tar.gz
merge tip
Diffstat (limited to 'examples')
-rw-r--r--examples/beaker_caching/caching_query.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/examples/beaker_caching/caching_query.py b/examples/beaker_caching/caching_query.py
index 0b2238282..a94eea6ac 100644
--- a/examples/beaker_caching/caching_query.py
+++ b/examples/beaker_caching/caching_query.py
@@ -62,6 +62,14 @@ class CachingQuery(Query):
"""override __iter__ to pull results from Beaker
if particular attributes have been configured.
+ Note that this approach does *not* detach the loaded objects from
+ the current session. If the cache backend is an in-process cache
+ (like "memory") and lives beyond the scope of the current session's
+ transaction, those objects may be expired. The method here can be
+ modified to first expunge() each loaded item from the current
+ session before returning the list of items, so that the items
+ in the cache are not the same ones in the current Session.
+
"""
if hasattr(self, '_cache_parameters'):
return self.get_value(createfunc=lambda: list(Query.__iter__(self)))