It would be awesome if there was an easy way to cache results to a file and if the cache was found then load from the cache without recomputing.
To basically support the following usecase/api
# main.py
def expensive_function(x):
"""Consider an expensive to compute function"""
print(x, end=" ")
return x**2
s = seq([x for x in range(4)], cache_dir="/path/to/cache/dir")
expensive_result = s.map(expensive_function)\
.with_caching(name="expensive_result")
expensive_result.for_each(lambda x: print(f"\n", x, end=""))
First run:
$ python main.py
0 1 2 3
0
1
4
9
Second run (the first run should have created the cache file which will now be used instead of recomputing the sequence expensive_result):
Please let me know if you have any questions or would like some clarifications.
Loving the project so far, thanks for your effort!
It would be awesome if there was an easy way to cache results to a file and if the cache was found then load from the cache without recomputing.
To basically support the following usecase/api
First run:
Second run (the first run should have created the cache file which will now be used instead of recomputing the sequence
expensive_result):Please let me know if you have any questions or would like some clarifications.
Loving the project so far, thanks for your effort!