Back to index

plone3  3.1.7
Public Member Functions | Static Public Attributes
wicked.utils.Memoizer Class Reference
Collaboration diagram for wicked.utils.Memoizer:
Collaboration graph

List of all members.

Public Member Functions

def clearbefore
def memoizedproperty
def memoize

Static Public Attributes

string propname = '_mp_cache'

Detailed Description

Definition at line 188 of file

Member Function Documentation

def wicked.utils.Memoizer.clearbefore (   self,

Definition at line 190 of file

00191     def clearbefore(self, func):
00192         def clear(*args, **kwargs):
00193             inst=args[0]
00194             if hasattr(inst, self.propname):
00195                 delattr(inst, self.propname)
00196             return func(*args, **kwargs)
00197         return clear

def wicked.utils.Memoizer.memoize (   self,

Definition at line 201 of file

00202     def memoize(self, func):
00203         def memogetter(*args, **kwargs):
00204             inst = args[0]
00205             cache = getattr(inst, self.propname, dict())
00206             key=hash((func.__name__, args, frozenset(kwargs)))
00207             val = cache.get(key, _marker)
00208             if val is _marker:
00209                 val=func(*args, **kwargs)
00210                 cache[key]=val
00211                 setattr(inst, self.propname, cache)
00212             return val
00213         return memogetter

Here is the call graph for this function:

Here is the caller graph for this function:

def wicked.utils.Memoizer.memoizedproperty (   self,

Definition at line 198 of file

00199     def memoizedproperty(self, func):
00200         return property(self.memoize(func))

Here is the call graph for this function:

Member Data Documentation

string wicked.utils.Memoizer.propname = '_mp_cache' [static]

Definition at line 189 of file

The documentation for this class was generated from the following file: