So I'm using @lru_cache
on my objects in different parts, and I'm just wondering how to flush the cache on all functions on an object where @lru_cache is used, something like:
for i in dir(self):
if 'cache_clear' in dir(i):
self.get_attr(i).cache_clear()
The problem is:
- I'm not sure if this is really a very elegant way to do it
- cache_clear doesn't actually appear when I do dir() on the function which it decorates
What's the best way to do this?