app/soc/cache/base.py
changeset 1829 c9f30de8804f
parent 1418 50e989482d1b
child 2070 9555be8634a3
equal deleted inserted replaced
1828:3db2a7be7239 1829:c9f30de8804f
    33   # get and put in terms of key, depends on further usage
    33   # get and put in terms of key, depends on further usage
    34 
    34 
    35   def cache(func):
    35   def cache(func):
    36     """Decorator that caches the result from func.
    36     """Decorator that caches the result from func.
    37     """
    37     """
    38   
    38 
    39     @wraps(func)
    39     @wraps(func)
    40     def wrapper(*args, **kwargs):
    40     def wrapper(*args, **kwargs):
    41       result, key = get(*args, **kwargs)
    41       result, key = get(*args, **kwargs)
    42       if result:
    42       if result:
    43         return result
    43         return result