caching-strategy

caching-strategy is a skill for Claude Code, Codex from khalilbenaz/claude-skills-collection. It costs 103 tokens per session (2,264 once invoked), scanned A, original, MIT.

A guide to choosing and designing caches, temporary stores that keep frequently needed data closer to an application. It covers browser and CDN caches, in-memory storage, Redis, Memcached, expiration, invalidation, and data consistency.

In plain words
What is it for?
Use it to decide what to cache, where to cache it, how long it should live, and how to handle single-instance or multi-instance applications.
Why use it?
It helps reduce repeated database or third-party API calls without serving data that is too old or becoming difficult to keep consistent.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it to decide what to cache, where to cache it, how long it should live, and how to handle single-instance or multi-instance applications.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/khalilbenaz/claude-skills-collection/caching-strategy
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add khalilbenaz/claude-skills-collection --skill caching-strategy
Clone the repo
git clone --depth 1 https://github.com/khalilbenaz/claude-skills-collection

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for caching-strategy

README.md
[![agentmods](https://agentmods.dev/badge/skills/khalilbenaz/claude-skills-collection/caching-strategy/github.svg)](https://agentmods.dev/skills/khalilbenaz/claude-skills-collection/caching-strategy)
Your own site
<a href="https://agentmods.dev/skills/khalilbenaz/claude-skills-collection/caching-strategy"><img src="https://agentmods.dev/badge/skills/khalilbenaz/claude-skills-collection/caching-strategy/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for caching-strategy

Your own site · 80×15
<a href="https://agentmods.dev/skills/khalilbenaz/claude-skills-collection/caching-strategy"><img src="https://agentmods.dev/badge/skills/khalilbenaz/claude-skills-collection/caching-strategy.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 103 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,264 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00103 $0.02264
Opus 5 $0.00051 $0.01132
Sonnet 5 $0.00021 $0.00453
Haiku 4.5 $0.00010 $0.00226

Measured 8d ago against content hash 1faf92bb2028, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-11, from the pricing page.

Security

Grade A, and why

caching-strategy scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 8d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

dev-skills/caching-strategy/SKILL.md · 224 lines

How it starts

The opening of the file, as written. The whole thing — 224 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Caching Strategy

Workflow

1. Qualifier le besoin

Avant de cacher quoi que ce soit, répondre à ces trois questions :

Question Cache pertinent si…
Ratio lecture/écriture ? Lectures >> écritures (≥ 10:1)
Données partagées entre instances ? Oui → distributed cache obligatoire
Tolérance à la stale data ? Si cohérence stricte requise, invalidation event-based obligatoire

Cibles prioritaires : résultats de requêtes DB coûteuses, appels API tiers (limités en rate), calculs d'agrégation, sessions utilisateur.

2. Choisir le bon niveau de cache

Requête utilisateur
      │
      ▼
[Browser cache]          ← Cache-Control, ETag, Last-Modified
      │
      ▼
[CDN / Edge cache]       ← Cloudflare, Azure CDN, AWS CloudFront
      │
      ▼
[Application cache]      ← In-process (MemoryCache) ou distributed (Redis)
      │
      ▼
[Database query cache]   ← pg_bouncer result cache, MySQL query cache (désactivé > MySQL 8)
      │
      ▼
[Source of truth]        ← Base de données / API tierce

Règle de décision :

  • Instance unique, faible volume → MemoryCache (.NET) / caffeine (Java) / dict Python
  • Multi-instances / scalabilité → Redis ou Memcached
  • Assets statiques / réponses HTTP entières → CDN
  • API REST publique → HTTP Cache-Control + ETag

3. Sélectionner le pattern

Pattern Quand l'utiliser Trade-off
Cache-aside (lazy) Contrôle maximal, données hétérogènes Double aller DB au premier miss
Read-through Simplification du code applicatif Complexité déportée vers le cache
Write-through Cohérence forte (lecture après écriture) Latence d'écriture augmentée
Write-behind Throughput d'écriture maximal Risque de perte de données si crash
Refresh-ahead Données populaires avec TTL court Prématuré si prédiction inexacte

Pattern le plus courant en production : cache-aside + invalidation active sur mutation.

4. Concevoir les cache keys

Read the full file on GitHub · 224 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 8d ago First seen · 224 lines · 103 tokens per session scan A 1faf92bb2028

Subscribe to this mod's changes

caching-strategy is a skill published in the GitHub repository khalilbenaz/claude-skills-collection (22 stars, last pushed 17d ago), licensed MIT. It adds 103 tokens to every session and 2,264 once invoked, about $0.0005 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.

Related

Other skills, from other repositories

redis-cache-strategy

Redis caching strategy designer and reviewer. ALWAYS use when designing, reviewing, or troubleshooting Redis caching layers — cache pattern selection (cache-aside, write-through, write-behind), TTL strategy, cache stampede/penetration/avalanche prevention, hot key handling, cache-DB consistency, distributed locking…

johnqtcg/awesome-skills · 113 tokens

spring-cache

Spring Cache abstraction for Spring Boot 3.x. Covers @Cacheable, @CacheEvict, @CachePut, cache managers (Caffeine, Redis, EhCache), TTL configuration, cache keys, conditional caching, and cache synchronization. USE WHEN: user mentions "spring cache", "@Cacheable", "@CacheEvict", "cache manager", "Caffeine cache"…

claude-dev-suite/claude-dev-suite · 114 tokens

caching-strategies

Application caching patterns. Redis caching, in-memory caches, HTTP caching, cache invalidation strategies, cache-aside, write-through, and CDN caching. USE WHEN: user mentions "caching", "cache invalidation", "Redis cache", "HTTP cache", "CDN caching", "cache-aside", "write-through", "TTL", "stale-while-revalidate"…

claude-dev-suite/claude-dev-suite · 111 tokens

api-database-redis

Redis in-memory data store patterns with ioredis and node-redis -- caching, sessions, rate limiting, pub/sub, streams, queues, transactions, cluster.

agents-inc/skills · 38 tokens

api-caching-strategies

Application-level caching strategies, HTTP caching, cache invalidation, and stampede prevention.

agents-inc/skills · 23 tokens

api-performance-api-performance

Query optimization, caching, indexing, connection pooling, async patterns.

agents-inc/skills · 17 tokens