mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2024-11-22 17:46:37 +03:00
9 lines
315 B
Python
9 lines
315 B
Python
|
# Reference: http://code.activestate.com/recipes/325205-cache-decorator-in-python-24/
|
||
|
def cachedmethod(f, cache={}):
|
||
|
def _(*args, **kwargs):
|
||
|
key = (f, tuple(args), frozenset(kwargs.items()))
|
||
|
if key not in cache:
|
||
|
cache[key] = f(*args, **kwargs)
|
||
|
return cache[key]
|
||
|
return _
|