From 8a39c3d100c5237cf0229813b4afb6296ed5266c Mon Sep 17 00:00:00 2001 From: nineven Date: Wed, 8 Apr 2020 15:58:06 +0800 Subject: [PATCH] fix a bug --- fir_ser/api/utils/storage/caches.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/fir_ser/api/utils/storage/caches.py b/fir_ser/api/utils/storage/caches.py index a93b939..63ee5bd 100644 --- a/fir_ser/api/utils/storage/caches.py +++ b/fir_ser/api/utils/storage/caches.py @@ -13,12 +13,13 @@ from api.utils.storage.storage import Storage,LocalStorage from api.utils.crontab.sync_cache import sync_download_times_by_app_id from api.utils.crontab import run -def get_download_url_by_cache(app_obj, filename, limit, isdownload=True): +def get_download_url_by_cache(app_obj, filename, limit, isdownload=True,key=''): now = time.time() if isdownload is None: local_storage = LocalStorage('localhost', False) return local_storage.get_download_url(filename, limit, 'plist') - download_val = cache.get("%s_%s" % ('download_url', filename)) + down_key = "_".join([key.lower(), CACHE_KEY_TEMPLATE.get('download_url_key'), filename]) + download_val = cache.get(down_key) if download_val: if download_val.get("time") > now - 60: return download_val.get("download_url")