python-diskcache
python-diskcache copied to clipboard
Passing ignore arguments to memoized cache from local scope (diskcache python)
How to pass ignore arguments to the memoized cache in diskcache from local scope .
1.Since Cache is stored on disk , can it access the ignored arguments globally?
2.Is there a better way than writing wrappper function around the cached function?
Error: Unresolved Reference for ignore={threshold_days, folder_path}
import diskcache as dc
from datetime import datetime
cache = dc.Cache()
#LocalScope issue - Undefined Reference ignore={threshold_days, folder_path}
@dc.Cache().memoize(tag='runoncetoday', ignore={threshold_days, folder_path})
def delete_olddata_func(day_today):
# run file deleteion function only once at the start of the day and skip it when called again on the same day .
pass
if __name__ == "__main__" :
day_today = datetime.now().date()
threshold_days = 25
folder_path = "/myDir"
delete_olddata_func(day_today=day_today, threshold_days=threshold_days, folder_path)