Files
Orchestrator/bahn/teamlandkarte-mcp/tests/test_query_cache.py
T
ankn a5f8fb49ab Migrate all repos into monorepo context folders
Bahn: aisupport, Analyse-O2C-C2S, awesome-bahn-mcp-servers, beam-mcp,
      Confluence_Bot, db-planet-mcp-server, O2C-Harness, project-audit,
      Projekt-KIQ-HP, teamlandkarte-mcp
Dhive: Jury-Voting
Privat: CV, NoteGraph (NOTE: NoteGraph needs complete redo after consolidation)
Shared: AI-Orchestrator, OrgMyLife, power_skills_and_more
Shared/references: symphony (read-only)

Bahn repos remain available as independent remotes - this monorepo
pulls them in via subtree, the originals are untouched.
2026-06-30 20:39:52 +02:00

22 lines
567 B
Python

from __future__ import annotations
from teamlandkarte_mcp.cache.query_cache import QueryCache
def test_query_cache_hit_miss_behavior() -> None:
cache: QueryCache[int] = QueryCache(ttl_hours=12, max_size=10)
calls = {"n": 0}
def fetch() -> int:
calls["n"] += 1
return 123
assert cache.get_or_fetch("k", fetch) == 123
assert cache.stats["misses"] == 1
assert cache.stats["hits"] == 0
assert calls["n"] == 1
assert cache.get_or_fetch("k", fetch) == 123
assert cache.stats["hits"] == 1
assert calls["n"] == 1