Source code for means.util.decorators
from functools import wraps
[docs]def cache(func):
cache = {}
@wraps(func)
def wrap(*args):
if args not in cache:
cache[args] = func(*args)
return cache[args]
return wrap