Files
tech-log-backend/docs/superpowers/plans/2026-07-28-redis-cache-resilience.md
T

53 lines
2.2 KiB
Markdown

# Redis Cache Resilience Implementation Plan
> Repository commit policy is human-only. Do not stage, commit, amend or push.
**Goal:** Implement the approved cache-aside, bounded source protection and soft/hard TTL design
without promoting Redis beyond standalone cache R1.
### Task 1: Application cache-aside outcomes and policy
**Files:**
- Create/modify `src/application-core/src/main/java/dev/caskeleton/application/cache/*`
- Test `src/application-core/src/test/java/dev/caskeleton/application/cache/*`
- [x] Write RED tests for fresh/negative/miss/stale/source outcome transitions.
- [x] Add typed loader, failure, result, cancellation and immutable policy contracts.
- [x] Implement cache-aside sequencing; only authoritative absence may be negative-cached.
- [x] Preserve unclassified exceptions and interruption.
- [x] Verify focused application cache tests GREEN.
### Task 2: Bounded local single-flight and source bulkhead
**Files:**
- Create `CacheSingleFlight.java`
- Create `CacheSourceBulkhead.java`
- Test their concurrency behavior through focused unit tests.
- [x] Write RED concurrency tests.
- [x] Bound in-flight keys, waiters, admission wait and load wait.
- [x] Remove completed/failed/abandoned flights and preserve loader failure fan-out.
- [x] Prove Redis outage cannot create unlimited source concurrency.
### Task 3: Redis soft/hard TTL, jitter and stale envelope
**Files:**
- Modify `RedisCacheRegionPolicy.java`
- Modify `RedisCacheEnvelopeCodec.java`
- Modify `RedisStringCacheRegion.java`
- Modify/add focused Redis cache tests.
- [x] Write RED boundary, jitter, minimum and schema-compatibility tests.
- [x] Add an injected `Clock` and deterministic policy-revision jitter.
- [x] Encode absolute soft/hard expiry in envelope version 2.
- [x] Use the encoded hard expiry as physical Redis TTL.
- [x] Verify focused Redis tests GREEN.
### Task 4: Documentation and verification
- [x] Synchronize the completed foundation-plan checkboxes with existing code/evidence.
- [x] Update Redis README/CLAUDE/design readiness truth.
- [ ] Run application and Redis leaf checks.
- [ ] Run dependency locks, architecture, public path, env and diff checks.
- [x] Request independent specification and code-quality review.