diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2011-01-02 14:23:42 -0500 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2011-01-02 14:23:42 -0500 |
| commit | 350aed3fdb9f1e73e69655e53f44ca6a91c196da (patch) | |
| tree | 3d2a128667b5f6ca6d0b4e1f4865fc98aac6b60b /examples/beaker_caching/advanced.py | |
| parent | 71f92436bdc86f30e2c21d8f5244733601e8c39e (diff) | |
| download | sqlalchemy-350aed3fdb9f1e73e69655e53f44ca6a91c196da.tar.gz | |
- whitespace removal bonanza
Diffstat (limited to 'examples/beaker_caching/advanced.py')
| -rw-r--r-- | examples/beaker_caching/advanced.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/examples/beaker_caching/advanced.py b/examples/beaker_caching/advanced.py index 113060033..c16e02f33 100644 --- a/examples/beaker_caching/advanced.py +++ b/examples/beaker_caching/advanced.py @@ -13,13 +13,13 @@ from sqlalchemy.orm import joinedload def load_name_range(start, end, invalidate=False): """Load Person objects on a range of names. - + start/end are integers, range is then "person <start>" - "person <end>". - + The cache option we set up is called "name_range", indicating a range of names for the Person class. - + The `Person.addresses` collections are also cached. Its basically another level of tuning here, as that particular cache option can be transparently replaced with joinedload(Person.addresses). @@ -36,17 +36,17 @@ 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(RelationshipCache("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 # a single, larger value in the cache per person rather than two # separate ones. #q = q.options(joinedload(Person.addresses)) - + # if requested, invalidate the cache on current criterion. if invalidate: q.invalidate() - + return q.all() print "two through twelve, possibly from cache:\n" |
