🎯 Key Takeaways for quick navigation: 00:00 🚀 *Introduction to caching in Python* - Caching involves storing function call results to save time in subsequent calls. - By default, Python has the `@lru_cache` decorator, which is limited to a single session. 01:00 🔄 *Using the built-in lru_cache decorator* - `@lru_cache` helps speed up function calls by storing results. - The cache is session-specific and doesn't persist across sessions. 03:00 📦 *Creating a custom exportable cache decorator* - Developing a custom decorator called `exportable_cache` to enable cache export/import. - The decorator uses a dictionary to store cached results. - It serializes the cache to a file for persistent use across sessions. 08:56 💾 *Exporting the cache to a file* - Demonstrates how to export the cache to a pickle file. - This allows reusing the cache in future sessions, improving efficiency for computationally intensive functions. Made with HARPA AI
Haven't tested it, and am currently exhausted, however with the way you're caching the data couldn't you have issues with mutables getting passed in but having a different value between calls?