-
I can't find a way to invalidate a cache (specifically, methodcache) entierly. I have a test suite that is run in random order using pytest-randomly, and I need a way to clear all caches between individual test runs, otherwise tests become flaky due to stale cache. |
Beta Was this translation helpful? Give feedback.
Answered by
awolverp
Sep 4, 2025
Replies: 1 comment
-
Hi, you can directly access the cache of the cached function or method and clear, or invalidate a key # Clear cache
MyClass.method.cache.clear()
# invalidate a key
MyClass.method.cache.pop("key") |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
emorozov
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi, you can directly access the cache of the cached function or method and clear, or invalidate a key