Clear all lru_cache in Python
<p>I have functions in python that have caches with lru_cache e.g. </p>

<pre><code> @lru_cache(maxsize=None)
 def my_function():
    ...
</code></pre>

<p>While i can individually clear the caches with e.g. <code>my_function.cache_clear()</code> is there any way of clearing the caches of every function at once? [I was thinking that maybe there is a way of returning all function names loaded in memory, and then loop over them clearing the cache from each].</p>

<p>I'm specifically looking to implement as part of a fall-back, for cases where say 90% of the memory on my machine gets used.</p>