update_time_sec = 3300
with _lock_services:
    if os.path.getctime(tmp_file) < time.time() - update_time_sec:
        os.system('%s  >%s' % ("echo '{}'", tmp_file))
with open(tmp_file, 'r') as json_data:
    cache_variable = json.load(json_data)
Caching a downloaded file based on modified time using dogpile