I have an application with data that is updated every couple days. Thusly, the default cache timeout is of 24 hours. Nevertheless, I want to force the update when the source data changes.
I have a method to know when the data changes, called get_last_data_updated(). Also, the date is saved when the result of a function is memoized, so I can do returned_object.last_update.
I want to add a forced_update callable to the memoized function with the following behaviour:
I have an application with data that is updated every couple days. Thusly, the default cache timeout is of 24 hours. Nevertheless, I want to force the update when the source data changes.
I have a method to know when the data changes, called
get_last_data_updated()
. Also, the date is saved when the result of a function is memoized, so I can doreturned_object.last_update
.I want to add a
forced_update
callable to the memoized function with the following behaviour:Nevertheless, I don't know how to access the cached object, only the arguments of the function. How can I accomplish something like this?