We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 800a488 commit 78b9871Copy full SHA for 78b9871
README.rst
@@ -135,6 +135,22 @@ instances per loop:
135
_local.fetcher = fetch_data
136
return _local.fetcher
137
138
+You can also reuse the logic of an already decorated function in a new loop by accessing ``__wrapped__``:
139
+
140
+.. code-block:: python
141
142
+ @alru_cache(maxsize=32)
143
+ async def my_task(x):
144
+ ...
145
146
+ # In Loop 1:
147
+ # my_task() uses the default global cache instance
148
149
+ # In Loop 2 (or a new thread):
150
+ # Create a fresh cache instance for the same logic
151
+ cached_task_loop2 = alru_cache(maxsize=32)(my_task.__wrapped__)
152
+ await cached_task_loop2(x)
153
154
Benchmarks
155
----------
156
0 commit comments