Add cache invalidation on write operations for cached endpoints #32

Closed
opened 2026-02-20 06:50:40 +00:00 by cal · 1 comment
Owner

GET endpoints use @cache_result with 30-min TTLs, but PATCH/PUT/POST/DELETE endpoints don't call invalidate_cache(). PlayerService defines cache_patterns but they're never used to clear cache after writes. Stale data persists up to 30 minutes.

Priority: medium | Labels: bug, performance

GET endpoints use `@cache_result` with 30-min TTLs, but PATCH/PUT/POST/DELETE endpoints don't call `invalidate_cache()`. `PlayerService` defines `cache_patterns` but they're never used to clear cache after writes. Stale data persists up to 30 minutes. **Priority**: medium | **Labels**: bug, performance
cal added the
ai-working
label 2026-03-05 19:01:02 +00:00
cal removed the
ai-working
label 2026-03-05 19:04:14 +00:00
Author
Owner

Fixed in PR #47.

Added finally: blocks to update_player, patch_player, create_players, and delete_player in PlayerService that call temp_service.invalidate_related_cache(cls.cache_patterns). This activates the existing cache_patterns = ["players*", "players-search*", "player*", "team-roster*"] that was defined but never used. Matches the pattern already correctly implemented in TeamService.

Fixed in PR #47. Added `finally:` blocks to `update_player`, `patch_player`, `create_players`, and `delete_player` in `PlayerService` that call `temp_service.invalidate_related_cache(cls.cache_patterns)`. This activates the existing `cache_patterns = ["players*", "players-search*", "player*", "team-roster*"]` that was defined but never used. Matches the pattern already correctly implemented in `TeamService`.
cal added the
ai-pr-opened
label 2026-03-05 19:04:20 +00:00
cal closed this issue 2026-03-10 18:26:18 +00:00
Sign in to join this conversation.
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: cal/major-domo-database#32
No description provided.