add utility for caching values in the request
git-svn-id: svn://svn.cy55.de/Zope3/src/cybertools/trunk@3794 fd906abe-77d9-0310-91a1-e0d9ade77398
This commit is contained in:
parent
fc3230e5b5
commit
b880efba3e
2 changed files with 3 additions and 3 deletions
|
@ -31,7 +31,7 @@ def caching(self, method, id):
|
|||
item = annot.setdefault('cybertools.zutil.rcache', {})
|
||||
value = item.get(id, INVALID)
|
||||
if value is INVALID:
|
||||
value = method()
|
||||
value = method(self)
|
||||
item[id] = value
|
||||
return value
|
||||
|
||||
|
|
|
@ -12,12 +12,12 @@ $Id$
|
|||
... self.request = request
|
||||
...
|
||||
... @rcache
|
||||
... def calculate():
|
||||
... def calculate(self):
|
||||
... print 'calculating'
|
||||
... return 42
|
||||
...
|
||||
... @rcacheproperty
|
||||
... def value():
|
||||
... def value(self):
|
||||
... print 'calculating'
|
||||
... return 43
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue