summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJay Hutchinson <jlhutch@gmail.com>2015-03-18 02:08:38 -0500
committerJay Hutchinson <jlhutch@gmail.com>2015-03-18 02:11:41 -0500
commitd35ec71c4e694db83fc5ecedc8e3f11a3dd39749 (patch)
tree0a71d6e042f09e5e91361ebdf2fff9af95687c95
parent7bdea5954a537245ecb5b9bb6cb446805f7e2578 (diff)
downloadpylru-d35ec71c4e694db83fc5ecedc8e3f11a3dd39749.tar.gz
lrudecorator now updates the metadata to look more like the wrapped function.
Fixes #10
-rw-r--r--pylru.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/pylru.py b/pylru.py
index 5cb4130..eef0593 100644
--- a/pylru.py
+++ b/pylru.py
@@ -531,10 +531,12 @@ def lruwrap(store, size, writeback=False):
else:
return WriteThroughCacheManager(store, size)
+import functools
class lrudecorator(object):
def __init__(self, size):
self.size = size
def __call__(self, func):
- return FunctionCacheManager(func, self.size)
+ wrapper = FunctionCacheManager(func, self.size)
+ return functools.update_wrapper(wrapper, func)