`lru_cache` is good, but if you need *persistent* python cache (like across runs), try `diskcache`.
It’s file-based, so slower than RAM, but handy for long-term stuff.
For invalidation, maybe use a hash of your data as part of the cache key?
Bonus: `diskcache` has atomic writes, so less risk of corruption.
It’s file-based, so slower than RAM, but handy for long-term stuff.
For invalidation, maybe use a hash of your data as part of the cache key?
Bonus: `diskcache` has atomic writes, so less risk of corruption.
