Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def wrapper(*args, **kwds):
_args, _kwds = rounded_args(*args, **kwds)
_args, _kwds = _keygen(user_function, ignore, *_args, **_kwds)
key = keymap(*_args, **_kwds)
try:
# get cache entry
result = cache[key]
# record recent use of this key
queue_append(key)
refcount[key] += 1
stats[HIT] += 1
except KeyError:
# if not in cache, look in archive
if cache.archived():
cache.load(key)
try:
result = cache[key]
# record recent use of this key
def wrapper(*args, **kwds):
try:
_args, _kwds = rounded_args(*args, **kwds)
_args, _kwds = _keygen(user_function, ignore, *_args, **_kwds)
key = keymap(*_args, **_kwds)
except: #TypeError
result = user_function(*args, **kwds)
stats[MISS] += 1
return result
try:
# get cache entry
result = cache[key]
use_count[key] += 1
stats[HIT] += 1
except KeyError:
# if not in cache, look in archive
if cache.archived():
cache.load(key)
try:
def lookup(*args, **kwds):
"""Get the stored value for the given *args,**kwds"""
_args, _kwds = rounded_args(*args, **kwds)
_args, _kwds = _keygen(user_function, ignore, *_args, **_kwds)
return cache[keymap(*_args, **_kwds)]
def key(*args, **kwds):
"""Get the cache key for the given *args,**kwds"""
_args, _kwds = rounded_args(*args, **kwds)
_args, _kwds = _keygen(user_function, ignore, *_args, **_kwds)
return keymap(*_args, **_kwds)
def lookup(*args, **kwds):
"""Get the stored value for the given *args,**kwds"""
_args, _kwds = rounded_args(*args, **kwds)
_args, _kwds = _keygen(user_function, ignore, *_args, **_kwds)
return cache[keymap(*_args, **_kwds)]
def key(*args, **kwds):
"""Get the cache key for the given *args,**kwds"""
_args, _kwds = rounded_args(*args, **kwds)
_args, _kwds = _keygen(user_function, ignore, *_args, **_kwds)
return keymap(*_args, **_kwds)