Skip to content
Snippets Groups Projects
Commit 032b09f6 authored by Mike Bayer's avatar Mike Bayer
Browse files

- The Beaker import (or attempt thereof)

  is delayed until actually needed;
  this to remove the performance penalty
  from startup, particularly for
  "single execution" environments
  such as shell scripts. [ticket:153]
parent 69cf8fef
No related branches found
No related tags found
No related merge requests found
......@@ -5,6 +5,13 @@
for those who don't use the caching
as well as to conform to Pyramid
deployment practices. [ticket:154]
- The Beaker import (or attempt thereof)
is delayed until actually needed;
this to remove the performance penalty
from startup, particularly for
"single execution" environments
such as shell scripts. [ticket:153]
- Fixed missing **extra collection in
setup.py which prevented setup.py
......
from mako import exceptions
try:
from beaker import cache
cache = cache.CacheManager()
except ImportError:
cache = None
cache = None
class BeakerMissing(object):
def get_cache(self, name, **kwargs):
raise exceptions.RuntimeException("the Beaker package is required to use cache functionality.")
class Cache(object):
def __init__(self, id, starttime):
......@@ -43,8 +43,16 @@ class Cache(object):
self.invalidate(name, defname=name)
def _get_cache(self, defname, type=None, **kw):
global cache
if not cache:
raise exceptions.RuntimeException("the Beaker package is required to use cache functionality.")
try:
from beaker import cache as beaker_cache
cache = beaker_cache.CacheManager()
except ImportError:
# keep a fake cache around so subsequent
# calls don't attempt to re-import
cache = BeakerMissing()
if type == 'memcached':
type = 'ext:memcached'
if not type:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment