Python caching results of large computations (with a twist)

76 Views Asked by At

I'm good with Python and use functions to process large datasets from files, then return the results. I've realized these input files and other parameters don't change often, so I could store the returned results for reuse.

I've used @functools.lru_cache before, but I'm facing a challenge now. Even though file paths (passed as input to my functions) remain the same, sometimes I need to ignore the cached values if the file has been updated since the last call. I don't want to complicate my functions by checking for this.

I'm looking for a caching solution that can handle this. If anyone knows an existing solution, I'd love to hear it, so I don't have to create one from scratch.

Using functools.lru_cache complicated things for what I need.

0

There are 0 best solutions below