166 """Implementation of __call__.
168 Returns: (result, cacheHit)
172 if not AccumulatorDecorator._memoize:
173 return (self.
_func(*args , **kwargs),
None)
176 hsh = hash( (tuple(AccumulatorDecorator._getHash(a)
for a
in args),
177 frozenset((hash(k), AccumulatorDecorator._getHash(v))
for k,v
in kwargs.items())) )
182 if AccumulatorDecorator.VERIFY_HASH == self.
_verify:
184 chkHsh = AccumulatorDecorator._getHash(res)
186 _msg.debug(
"Hash of function result, cached using AccumulatorDecorator, changed.")
188 res = self.
_func(*args , **kwargs)
190 self.
_resultCache[hsh] = AccumulatorDecorator._getHash(res)
197 return deepcopy(res), cacheHit
200 from AthenaConfiguration.ComponentAccumulator
import ComponentAccumulator
201 if isinstance(res, ComponentAccumulator):
206 _msg.debug(
'Hash not found in AccumulatorCache for function %s' , self.
_func)
208 _msg.warning(
"Cache limit (%d) reached for %s.%s",
211 AccumulatorDecorator._evict(oldest)
213 res = self.
_func(*args , **kwargs)
215 if AccumulatorDecorator.VERIFY_HASH == self.
_verify:
218 self.
_resultCache[hsh] = AccumulatorDecorator._getHash(res)
223 return (deepcopy(res)
if self.
_deepcopy else res,
False)