diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2010-07-21 17:20:41 -0400 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2010-07-21 17:20:41 -0400 |
| commit | 5b91f627a4e5db44c45254f0cb32ac10d0dfabd0 (patch) | |
| tree | 9da70ff0e90fddf67664fe6a25633ccb162fb280 /examples | |
| parent | c6c8a39b8703ddbc420fb353ac2fdee38c2c8607 (diff) | |
| download | sqlalchemy-5b91f627a4e5db44c45254f0cb32ac10d0dfabd0.tar.gz | |
etc
Diffstat (limited to 'examples')
| -rw-r--r-- | examples/beaker_caching/caching_query.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/examples/beaker_caching/caching_query.py b/examples/beaker_caching/caching_query.py index 13227ed53..0b2238282 100644 --- a/examples/beaker_caching/caching_query.py +++ b/examples/beaker_caching/caching_query.py @@ -30,7 +30,8 @@ class CachingQuery(Query): a Beaker cache before accessing the database: * A "region", which is a cache region argument passed to a - Beaker CacheManager + Beaker CacheManager, specifies a particular cache configuration + (including backend implementation, expiration times, etc.) * A "namespace", which is a qualifying name that identifies a group of keys within the cache. A query that filters on a name might use the name "by_name", a query that filters on a date range @@ -60,6 +61,7 @@ class CachingQuery(Query): def __iter__(self): """override __iter__ to pull results from Beaker if particular attributes have been configured. + """ if hasattr(self, '_cache_parameters'): return self.get_value(createfunc=lambda: list(Query.__iter__(self))) @@ -67,7 +69,7 @@ class CachingQuery(Query): return Query.__iter__(self) def invalidate(self): - """Invalidate the cache represented in this Query.""" + """Invalidate the value represented by this Query.""" cache, cache_key = _get_cache_parameters(self) cache.remove(cache_key) @@ -75,7 +77,8 @@ class CachingQuery(Query): def get_value(self, merge=True, createfunc=None): """Return the value from the cache for this query. - Returns None if no value present. + Raise KeyError if no value present and no + createfunc specified. """ cache, cache_key = _get_cache_parameters(self) |
