MCPcopy Index your code
hub / github.com/TheAlgorithms/Python / cache_decorator_wrapper

Method cache_decorator_wrapper

other/lfu_cache.py:296–304  ·  view source on GitHub ↗
(*args: T)

Source from the content-addressed store, hash-verified

294 ] = {}
295
296 def cache_decorator_wrapper(*args: T) -> U:
297 if func not in decorator_function_to_instance_map:
298 decorator_function_to_instance_map[func] = LFUCache(size)
299
300 result = decorator_function_to_instance_map[func].get(args[0])
301 if result is None:
302 result = func(*args)
303 decorator_function_to_instance_map[func].put(args[0], result)
304 return result
305
306 def cache_info() -> LFUCache[T, U]:
307 return decorator_function_to_instance_map[func]

Callers

nothing calls this directly

Calls 4

LFUCacheClass · 0.85
funcFunction · 0.85
getMethod · 0.45
putMethod · 0.45

Tested by

no test coverage detected