namespace = util.func_namespace(func)
+ if region not in cache_regions:
+ raise BeakerException('Cache region not configured: %s' % region)
reg = cache_regions[region]
if not reg.get('enabled', True):
- if region not in cache_regions:
- raise BeakerException('Cache region not configured: %s' % region)
cache = Cache._get_cache(namespace, reg)
cache_key = " ".join(map(str, deco_args + args))
This is not usually the case however, as a session generally should not be
saved should something catastrophic happen during a request.
+ When using the Beaker middleware, you **must call save before the headers
+ are sent to the client**. Since Beaker's middleware watches for when the
+ ``start_response`` function is called to know that it should add its
+ cookie header, the session must be saved before its called.