Prevent a delayed refill from restoring availability older than an update
An origin read starts before a stock update, then finishes after invalidation and writes the old value back into the cache.
- Focused work estimate
- 5h 30m + prerequisites
- Priority in the scenario
- High
- Engineering practice
- Race conditions · Cache invalidation
Estimated field mix
- Distributed systems60%
- Performance engineering40%
Field percentages are editorial estimates of the ticket's engineering focus. They total 100%; they are not measured time, proficiency scores, or ownership evidence.
Review it, then add it to your workspace.
The board opens an editable draft; nothing is saved until you confirm it. Sign-in and workspace permissions apply, and Demo boards remain ephemeral.
Project context
A fictional equipment-rental service caches availability summaries. A campaign sends repeated reads, while stock updates and shared expiry times create bursts against the origin. Build a local origin stub and cache-backed read API using synthetic depots and products.
Setup prerequisites
- Create a deterministic local availability origin and Redis-backed reader with synthetic tenant, depot and product data.
- Use a seeded hot-key distribution and controlled time; record cache capacity, TTLs, runtime and machine limits.
Preceding work
Complete these dependencies, or supply their agreed outputs before taking this ticket.
- PCACHE-101 · Specify which availability responses may be reused
- PCACHE-102 · Measure saved origin work instead of celebrating the hit ratio
- PCACHE-103 · Create a hot-key workload that exposes synchronized expiry
- PCACHE-104 · Coalesce simultaneous availability misses for one key
- PCACHE-106 · Serve stale availability only within an explicit degraded-read policy
Acceptance criteria
- Associate fills and updates with an explicit revision or generation rule.
- Reject an obsolete fill after a newer invalidation or value is known within the chosen coordination scope.
- Document behavior when invalidation delivery is delayed and preserve the hard freshness ceiling as a backstop.
Implementation constraints
- Use atomic cache operations where a check-and-set race matters; explain limits across multiple readers rather than claiming perfect global freshness.
Verification to include
- Hold an old origin response, apply a newer update, then release it and verify the cached revision does not go backward.
- Repeat the sequence with duplicate invalidations and a cache reconnect; verify the declared recovery behavior and age bound.
Deliverables
- Revision protocol, race regression and coordination-limit note
Rollout and recovery
Introduce the revisioned namespace gradually; on uncertainty discard derived cache state and use the bounded origin path.
Value of the work
For the engineer: Learn to evaluate caching through avoided work, bounded staleness, concurrency and recovery rather than hit rate alone.
For the team: Produce a reviewable cache policy and failure exercise for a read-heavy service with changing business data.
Evidence boundaries
Outcome Evidence: Tests, patches, and runbooks are requested deliverables. They become Outcome Evidence only through a qualified Mission and immutable Evidence IDs.
Ownership Evidence: Independent adaptation must be observed under a declared verification policy and cite immutable Evidence IDs. Completing a planning ticket establishes no Ownership Evidence.