equal
deleted
inserted
replaced
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) |