"Python cache: What's the best way to speed up repetitive tasks?"
Hey everyone!
I’ve been working on a project where the same function gets called *a ton* with the same args. It’s slowing things down, and I’m thinking a python cache might help.
But I’m not sure—should I use `functools.lru_cache`, or is there a better way?
Also, how do you handle cache invalidation without making a mess? Like, what if the data changes and the cache is now stale?
Kinda new to this, so any tips or gotchas would be awesome!
Thanks in advance
Hey everyone!
I’ve been working on a project where the same function gets called *a ton* with the same args. It’s slowing things down, and I’m thinking a python cache might help.
But I’m not sure—should I use `functools.lru_cache`, or is there a better way?
Also, how do you handle cache invalidation without making a mess? Like, what if the data changes and the cache is now stale?
Kinda new to this, so any tips or gotchas would be awesome!
Thanks in advance
