feat: cache chat cards in Valkey

Valkey 9.1 in compose caches the immutable chat card (title, members,
created_at) used by GET /chats/{id} and by the membership check of the
message endpoints. Cache-aside with a write after commit, keys per
database, TTL plus allkeys-lru, persistence off. redis-py runs without
retries; on failure the cache is skipped for a few seconds and requests
go to PostgreSQL. Readiness does not depend on Valkey.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-01 21:17:55 +03:00
co-authored by Claude Opus 5.5
parent c7681b0e18
commit cae4b09147
46 changed files with 1769 additions and 210 deletions
+4 -2
View File
@@ -5,8 +5,10 @@
подменой только `DATABASE__NAME`, прогоняет `make test` и
`make student_test`, затем удаляет контейнер и базу — при любом исходе,
в том числе по Ctrl+C. Рабочая база и рабочий контейнер API не
трогаются. Только stdlib: всё через docker compose и make. Решение 12
design change `postgres-storage`.
трогаются. Valkey стенда общий: ключи кэша включают имя базы, и
карточки тестового прогона не смешиваются с рабочими. Только stdlib:
всё через docker compose и make. Решение 12 design change
`postgres-storage`.
Запускается напрямую `$(PYTHON)`, как проверки skeleton, а не через
`uv run`: uv пересылает SIGINT дочернему процессу, хотя тот уже получил