This commit is contained in:
@@ -70,6 +70,7 @@ _BASE_DIR = Path(__file__).resolve().parents[1]
|
||||
_DASHBOARD_SHARED_CACHE_FILE = _BASE_DIR / "data" / "dashboard_full_cache.pkl"
|
||||
_DASHBOARD_STALE_CACHE_FILE = _BASE_DIR / "data" / "dashboard_full_cache_stale.pkl"
|
||||
_SALES_ANALYSIS_PAGE_CACHE_DIR = _BASE_DIR / "data" / "sales_analysis_page_cache"
|
||||
_DAILY_SALES_VIEW_CACHE_DIR = _BASE_DIR / "data" / "daily_sales_view_cache"
|
||||
|
||||
|
||||
def cleanup_sales_cache():
|
||||
@@ -131,6 +132,15 @@ def clear_sales_cache():
|
||||
def clear_daily_sales_cache():
|
||||
"""清除當日業績 cache。"""
|
||||
_DAILY_SALES_PROCESSED_CACHE.clear()
|
||||
try:
|
||||
if _DAILY_SALES_VIEW_CACHE_DIR.exists():
|
||||
for cache_file in _DAILY_SALES_VIEW_CACHE_DIR.glob("*.pkl"):
|
||||
try:
|
||||
cache_file.unlink()
|
||||
except OSError:
|
||||
logger.debug("daily sales view cache file cleanup failed: %s", cache_file, exc_info=True)
|
||||
except OSError:
|
||||
logger.debug("daily sales view cache cleanup failed", exc_info=True)
|
||||
|
||||
|
||||
def clear_dashboard_cache():
|
||||
|
||||
Reference in New Issue
Block a user