caching-strategies
CDN, Redis, in-memory cache, cache invalidation, and distributed caching patterns
npx skills add cosmicstack-labs/mercury-agent-skills --skill caching-strategies --agent claude-code
Same command for any agent — swap --agent for codex, cursor, copilot.
Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.
# Caching Strategies Cache effectively to improve performance and reduce load. ## Cache Layers | Layer | Latency | Storage | Examples | |-------|---------|---------|----------| | Browser | Local | Small | localStorage, HTTP cache | | CDN | Regional | Large | CloudFront, CloudFlare, Fastly | | Application | In-process | Small | L1 cache (heap) | | Distributed | Network | Large | Redis, Memcached | | Database | Same host | Very large | Buffer pool, query cache | ## Caching Patterns ### Cache-Aside (Lazy Loading) ``` 1. Check cache → miss 2. Query database 3. Store in cache 4. Return ``` Best for: Read-heavy, general purpose. ### Write-Through ``` 1. Write to cache 2. Cache writes to DB (sync) 3. Return ``` Best for: Consistency critical, write-heavy. ### Write-Behind ``` 1. Write to cache 2. Return immediately 3. Cache writes to DB (async) ``` Best for: High throughput writes, eventual consistency OK. ### Refresh-Ahead - Cache proactively refreshes before expiry - Reduces latency spikes on cache miss - Requires predictive logic or scheduled refresh ## Cache Invalidation **Two hard things**: naming, cache invalidation, off-by-one errors. | Strategy | How | Risk | |----------|-----|---
- Cache Layers
- Caching Patterns
- Cache-Aside (Lazy Loading)
- Write-Through
- Write-Behind
- Refresh-Ahead
- Cache Invalidation
- Redis Patterns
What does the caching-strategies skill do?
CDN, Redis, in-memory cache, cache invalidation, and distributed caching patterns
How do I install it?
Run `npx skills add cosmicstack-labs/mercury-agent-skills --skill caching-strategies --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.
Where does this skill come from?
From cosmicstack-labs/mercury-agent-skills, a repository with 364 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.
Is a popular skill a good skill?
Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.