88
99
1010def get_caching_wrapper (user_function , max_size , ttl , algorithm , thread_safe , order_independent , custom_key_maker ):
11- """
12- Get a caching wrapper for FIFO cache
13- """
11+ """Get a caching wrapper for FIFO cache"""
1412
1513 cache = {} # the cache to store function results
1614 key_argument_map = {} # mapping from cache keys to user function arguments
@@ -39,9 +37,7 @@ def get_caching_wrapper(user_function, max_size, ttl, algorithm, thread_safe, or
3937 _VALUE = 3 # index for the value
4038
4139 def wrapper (* args , ** kwargs ):
42- """
43- The actual wrapper
44- """
40+ """The actual wrapper"""
4541 nonlocal hits , misses , root , full
4642 key = make_key (args , kwargs )
4743 cache_expired = False
@@ -93,9 +89,7 @@ def wrapper(*args, **kwargs):
9389 return result
9490
9591 def cache_clear ():
96- """
97- Clear the cache and its statistics information
98- """
92+ """Clear the cache and its statistics information"""
9993 nonlocal hits , misses , full
10094 with lock :
10195 cache .clear ()
@@ -107,6 +101,7 @@ def cache_clear():
107101 def cache_info ():
108102 """
109103 Show statistics information
104+
110105 :return: a CacheInfo object describing the cache
111106 """
112107 with lock :
@@ -190,7 +185,7 @@ def cache_contains_result(return_value, alive_only=True):
190185
191186 def cache_for_each (consumer ):
192187 """
193- Perform the given action for each cache element in an order determined by the algorithm (FIFO) until all
188+ Perform the given action for each cache element in an order determined by the algorithm until all
194189 elements have been processed or the action throws an error
195190
196191 :param consumer: an action function to process the cache elements. Must have 3 arguments:
0 commit comments