Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def _create_cached_wrapper(user_function, max_size, ttl, algorithm, thread_safe, order_independent, custom_key_maker):
"""
Factory that creates an actual executed function when a function is decorated with @cached
"""
if max_size == 0:
return statistic_cache.get_caching_wrapper(user_function, max_size, ttl, algorithm,
thread_safe, order_independent, custom_key_maker)
elif max_size is None:
return plain_cache.get_caching_wrapper(user_function, max_size, ttl, algorithm,
thread_safe, order_independent, custom_key_maker)
else:
cache_toolkit = get_cache_toolkit(algorithm)
return cache_toolkit.get_caching_wrapper(user_function, max_size, ttl, algorithm,
thread_safe, order_independent, custom_key_maker)