You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently we have a number of useful functions in tcutility.cache, but it would be good to be able to store it locally.
I propose we add the tcutility.cache.cache_file decorator. This will cache the results of a function and store it in a .json file.
Example:
@cache_file('test.json')deftest(a, b, c):
returna+b*ctest(1, 2, 3) # this will run the functiontest(1, 2, 3) # this will retrieve ittest(1, 4, 3) # this will run the functiontest(1, 2, 3) # this will retrieve ittest(1, 4, 3) # this will retrieve it
This script will store results in test.json. When a function call was already made with the same function, args and kwargs it will read it from the test.json file.
The text was updated successfully, but these errors were encountered:
Currently we have a number of useful functions in tcutility.cache, but it would be good to be able to store it locally.
I propose we add the
tcutility.cache.cache_file
decorator. This will cache the results of a function and store it in a.json
file.Example:
This script will store results in
test.json
. When a function call was already made with the same function, args and kwargs it will read it from thetest.json
file.The text was updated successfully, but these errors were encountered: