加速成長分析指紋快取
All checks were successful
CD Pipeline / deploy (push) Successful in 1m2s

This commit is contained in:
OoO
2026-05-19 13:24:11 +08:00
parent 4a0a8bf75b
commit 1d3da03eee
5 changed files with 84 additions and 4 deletions

View File

@@ -159,6 +159,22 @@ def test_clear_growth_cache_removes_shared_file(tmp_path, monkeypatch):
assert not shared_cache.exists()
def test_growth_source_fingerprint_short_cache_clears_with_growth_cache(tmp_path, monkeypatch):
from services import cache_service
shared_cache = tmp_path / "growth_analysis_cache.pkl"
monkeypatch.setattr(cache_service, "_GROWTH_SHARED_CACHE_FILE", shared_cache)
cache_service.clear_growth_cache()
cache_service.set_growth_source_fingerprint_cache("growth:source", ("2026-05-17", 10))
assert cache_service.get_growth_source_fingerprint_cache("growth:source") == ("2026-05-17", 10)
cache_service.clear_growth_cache()
assert cache_service.get_growth_source_fingerprint_cache("growth:source") is None
def test_daily_sales_shared_view_cache_roundtrip(tmp_path, monkeypatch):
from routes import daily_sales_routes