summaryrefslogtreecommitdiff
path: root/examples/beaker_caching/advanced.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2010-02-12 21:43:19 +0000
committerMike Bayer <mike_mp@zzzcomputing.com>2010-02-12 21:43:19 +0000
commita2a3b701c71b8c424c4e63ee455aed12db2c54e2 (patch)
treed0eaa112db9260fc9958bba05faece812d0a7c2f /examples/beaker_caching/advanced.py
parente0b40f88446b86a46e6c066b0cb85510c38c4d1b (diff)
downloadsqlalchemy-a2a3b701c71b8c424c4e63ee455aed12db2c54e2.tar.gz
- Changed the beaker cache example a bit to have a separate
RelationCache option for lazyload caching. This object does a lookup among any number of potential attributes more efficiently by grouping several into a common structure. Both FromCache and RelationCache are simpler individually.
Diffstat (limited to 'examples/beaker_caching/advanced.py')
-rw-r--r--examples/beaker_caching/advanced.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/examples/beaker_caching/advanced.py b/examples/beaker_caching/advanced.py
index ebb17cfe5..8e3361b1e 100644
--- a/examples/beaker_caching/advanced.py
+++ b/examples/beaker_caching/advanced.py
@@ -8,7 +8,7 @@ and collection caching.
import environment
from model import Person, Address, cache_address_bits
-from meta import Session, FromCache
+from meta import Session, FromCache, RelationCache
from sqlalchemy.orm import eagerload
def load_name_range(start, end, invalidate=False):
@@ -35,7 +35,7 @@ def load_name_range(start, end, invalidate=False):
# have the "addresses" collection cached separately
# each lazyload of Person.addresses loads from cache.
- q = q.options(FromCache("default", "by_person", Person.addresses))
+ q = q.options(RelationCache("default", "by_person", Person.addresses))
# alternatively, eagerly load the "addresses" collection, so that they'd
# be cached together. This issues a bigger SQL statement and caches