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

Method cache_decorator_wrapper

other/lru_cache.py:313–321  ·  view source on GitHub ↗
(*args: T)

Source from the content-addressed store, hash-verified

311 ] = {}
312
313 def cache_decorator_wrapper(*args: T) -> U:
314 if func not in decorator_function_to_instance_map:
315 decorator_function_to_instance_map[func] = LRUCache(size)
316
317 result = decorator_function_to_instance_map[func].get(args[0])
318 if result is None:
319 result = func(*args)
320 decorator_function_to_instance_map[func].put(args[0], result)
321 return result
322
323 def cache_info() -> LRUCache[T, U]:
324 return decorator_function_to_instance_map[func]

Callers

nothing calls this directly

Calls 4

funcFunction · 0.85
LRUCacheClass · 0.70
getMethod · 0.45
putMethod · 0.45

Tested by

no test coverage detected