]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
add a note
authorMike Bayer <mike_mp@zzzcomputing.com>
Wed, 25 Aug 2010 15:00:35 +0000 (11:00 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Wed, 25 Aug 2010 15:00:35 +0000 (11:00 -0400)
examples/beaker_caching/caching_query.py

index 0b2238282dfccec29f3fe4fd7fef3632cdd5d527..a94eea6ac247a520d2cd2cf76927e86788a2c01c 100644 (file)
@@ -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)))