sync
CI / backend-and-migrations (push) Canceled after 0s
CI / astro-build (push) Canceled after 0s
CI / compose-e2e (push) Canceled after 0s

This commit is contained in:
ik
2026-09-08 09:31:41 +07:00
parent 8b2d7e2e1c
commit ddb6909c4d
21 changed files with 255 additions and 58 deletions
+12
View File
@@ -9,3 +9,15 @@ def test_cache_copies_values_and_invalidates() -> None:
assert cache.get(("activity",), 20) == [{"score": 10}]
cache.invalidate()
assert cache.get(("activity",), 20) is None
def test_cache_bounds_memory_and_rejects_result_started_before_invalidation() -> None:
cache = PublicResponseCache(max_entries=2)
generation = cache.generation()
cache.set((1,), [1])
cache.set((2,), [2])
cache.set((3,), [3])
assert cache.get((1,), 20) is None
cache.invalidate()
cache.set((4,), [4], generation=generation)
assert cache.get((4,), 20) is None