You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Implement automatic cleanup of stale cache entries (#290)
* feat: add automatic stale cache cleanup
* Fix test expectations for new cleanup defaults
* Handle missing pickle files during stale cleanup
* Reset global params in cleanup test
* remove mypy ignore comments
Copy file name to clipboardExpand all lines: README.rst
+13Lines changed: 13 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -146,6 +146,8 @@ These parameters can be changed at any time and they will apply to all decorator
146
146
* `stale_after`
147
147
* `next_time`
148
148
* `wait_for_calc_timeout`
149
+
* `cleanup_stale`
150
+
* `cleanup_interval`
149
151
150
152
The current defaults can be fetched by calling `get_default_params`.
151
153
@@ -192,6 +194,17 @@ Sometimes you may want your function to trigger a calculation when it encounters
192
194
193
195
Further function calls made while the calculation is being performed will not trigger redundant calculations.
194
196
197
+
Automatic Cleanup of Stale Values
198
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
199
+
Setting ``cleanup_stale=True`` on a decorator will spawn a background thread that periodically removes stale cache entries. The interval between cleanup runs is controlled by ``cleanup_interval`` and defaults to one day.
0 commit comments