mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2026-08-04 14:55:40 +00:00
Some memory improvements of @cachedmethod
This commit is contained in:
parent
58b87e4b6b
commit
9404b63a42
4 changed files with 8 additions and 7 deletions
|
|
@ -14,11 +14,11 @@ def cachedmethod(f, cache={}):
|
|||
|
||||
def _(*args, **kwargs):
|
||||
try:
|
||||
key = (f, tuple(args), frozenset(kwargs.items()))
|
||||
key = hash((f, tuple(args), frozenset(kwargs.items())))
|
||||
if key not in cache:
|
||||
cache[key] = f(*args, **kwargs)
|
||||
except:
|
||||
key = "".join(str(_) for _ in (f, args, kwargs))
|
||||
key = hash("".join(str(_) for _ in (f, args, kwargs)))
|
||||
if key not in cache:
|
||||
cache[key] = f(*args, **kwargs)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue