[b]"What's the best way to implement a Python cache for performance optimization?"[/b] or [b]"How does Python cach

16 Replies, 1513 Views

`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.

Messages In This Thread



Users browsing this thread: 1 Guest(s)