caching-strategieslisted
Install: claude install-skill robsonkades/agent-skills
# Caching Strategies
## Purpose
A cache can reduce the arrival rate seen by an origin in `L = λ × W`: a simple cache-aside hit
avoids the origin load. A hit that initiates refresh or revalidation can still consume origin
resources. Batching, admission control and eliminating work can also reduce origin demand.
A stale, unbounded cache can show excellent hit rate; correctness, memory and origin protection
must be measured beside it.
## Workflow
Inspect the target's Maven/Gradle release/toolchain, resolved Caffeine/Spring Data/Jackson
versions, runtime image and cache configuration before choosing APIs. No universal Java baseline
is declared here; the configuration reference states its example baseline. Preserve project
versions and do not enable preview features or upgrade dependencies to fit an example. If workload,
freshness requirements or measurements are absent, identify the gap and offer a conditional
decision and measurement plan rather than inventing a hit rate or safe TTL.
1. **Measure source cost and capacity** (latency distribution, CPU/I/O and rate) before deciding.
Even a sub-millisecond lookup may matter at very high volume; latency alone is not the case.
2. **Measure the access distribution** and estimate `h` for the intended `maximumSize`.
3. **Model saved work and latency, not hit rate alone.** Estimate origin work avoided by hit
distribution and compare `h·T_hit + (1-h)·T_miss` (including queueing/load cost) with the
uncached distribution. Count