app/soc/cache/base.py
changeset 1029 a312e7007811
parent 1017 6ad4fdb48840
child 1307 091a21cf3627
equal deleted inserted replaced
1028:43fdf6739e8d 1029:a312e7007811
    24 
    24 
    25 from functools import wraps
    25 from functools import wraps
    26 
    26 
    27 
    27 
    28 def getCacher(get, put):
    28 def getCacher(get, put):
    29   """Returns a caching decorator that uses get and put
    29   """Returns a caching decorator that uses get and put.
    30   """
    30   """
    31 
    31 
    32   # TODO(SRabbelier) possibly accept 'key' instead, and define
    32   # TODO(SRabbelier) possibly accept 'key' instead, and define
    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 = get(*args, **kwargs)
    41       result = get(*args, **kwargs)