@cache('%(name)s%(args)s%(vars)s',5)

This commit is contained in:
Massimo Di Pierro committed 2012-03-28 22:13:32 -05:00
1 parent 5e27ae1aca
commit ecd2e19067
2 files changed
+4 -3

No files matched your search

+1 -1
View File
@@ -1 +1 @@
Version 1.99.7 (2012-03-28 21:53:08) dev Version 1.99.7 (2012-03-28 22:13:16) dev
+3 -2
View File
@@ -432,8 +432,9 @@ class Cache(object):
cache_model = self.ram cache_model = self.ram
def tmp(func): def tmp(func):
def action(): def action(*a,**b):
return cache_model(key, func, time_expire) key2 = key.replace('%(name)s',func.__name__).replace('%(args)s',str(a)).replace('%(vars)s',str(b))
return cache_model(key2, lambda a=a,b=b:func(*a,**b), time_expire)
action.__name___ = func.__name__ action.__name___ = func.__name__
action.__doc__ = func.__doc__ action.__doc__ = func.__doc__
return action return action