Skip to content
Back to skills

Caching Strategies

ASecurity

Caching — cache-aside, read/write-through, write-behind, HTTP caching and CDN, TTL and invalidation strategies, stampede protection, cache keys and tenancy, consistency trade-offs, measuring hit ratio. Use when adding or debugging caches (caching, cache invalidation, TTL, CDN, cache stampede, hit ratio).

  • 5 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added December 3, 2026
ai-agentsgodebuggingperformance

Security analysis

A100/100

Scanned December 3, 2026

npx -y skills add vectora-os/kit --skill caching-strategies --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Caching Strategies?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Caching Strategies
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/vectora-os-caching-strategies/badge)](https://www.skillsdirectory.com/skills/vectora-os-caching-strategies)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: caching-strategies
description: Caching — cache-aside, read/write-through, write-behind, HTTP caching and CDN, TTL and invalidation strategies, stampede protection, cache keys and tenancy, consistency trade-offs, measuring hit ratio. Use when adding or debugging caches (caching, cache invalidation, TTL, CDN, cache stampede, hit ratio).
metadata:
  category: performance
---

# Caching strategies

## Purpose

Use caches to cut latency and load without serving wrong or leaked data.

**Use when:** reads dominate and staleness is tolerable within a bound.

**Not for:** masking slow queries that should be fixed.

## Inputs

- Access patterns, staleness tolerance, data sensitivity.

## Outputs

- Cache design: layer, keys, TTL, invalidation, metrics.

## Read first

- [Project Brain](../../../project-brain/README.md) — `npm run brain -- query "caching strategies"` for prior decisions, patterns and anti-patterns.

## Steps

1. **Need.** Measure: hit potential and cost of misses.
   Done when benefit is quantified.
2. **Layer.** Choose layer (HTTP/CDN, distributed, in-process).
   Done when layer fits staleness and scope.
3. **Keys.** Include tenant and auth scope in keys; never cache across users unintentionally.
   Done when key design is reviewed for leaks.
4. **Invalidate.** TTL plus event-driven invalidation; stampede protection.
   Done when stale bounds are guaranteed.

## Best practices

- Measure hit ratio and stale reads.
- Request coalescing for hot keys.

## Common mistakes

- Caching personalized responses publicly.
- No invalidation strategy.

## Example

Catalog: CDN with stale-while-revalidate 60s plus purge on `ProductUpdated`; hit ratio 94%.

## Reusable prompt

```text
Apply the Caching strategies skill (.agents/skills/caching-strategies/SKILL.md).
Context: {{task card or question; links to PRD, ADRs, code paths}}
Constraints: {{approved thresholds, deadlines, allowed files}}
Design the cache layer, keys (with tenancy), TTL, invalidation and metrics; quantify the benefit.
Return: Cache design: layer, keys, TTL, invalidation, metrics..
Cite evidence (file:line, command output, source) for every claim; list open questions separately.
```

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.