make internal cache implementation available for testing even when lovely.memcached is present

git-svn-id: svn://svn.cy55.de/Zope3/src/cybertools/trunk@3784 fd906abe-77d9-0310-91a1-e0d9ade77398
This commit is contained in:
helmutm 2010-03-26 11:18:13 +00:00
parent 26aa91568b
commit cdb9bc94d0
2 changed files with 6 additions and 3 deletions

View file

@ -1,5 +1,5 @@
#
# Copyright (c) 2009 Helmut Merz helmutm@cy55.de
# Copyright (c) 2010 Helmut Merz helmutm@cy55.de
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -63,7 +63,7 @@ class CacheItem(object):
self.value = INVALID
def cache(getIdentifier, lifetime=3600):
def internalCache(getIdentifier, lifetime=3600):
def _cache(fct):
def __cache(*args, **kw):
id = getIdentifier(*args, **kw)
@ -76,6 +76,8 @@ def cache(getIdentifier, lifetime=3600):
return __cache
return _cache
cache = internalCache
# memcached implementation

View file

@ -4,7 +4,8 @@ Data Caching
$Id$
>>> from cybertools.util.cache import cache
>>> from cybertools.util import cache
>>> cache = cache.internalCache
>>> @cache(lambda *args: 'calc')
... def calculate():