Logo : Caching

Caching

Organisation
proyecto26
caching

Utilisez cette compétence lorsque l’utilisateur pose des questions sur une « caching strategy », l’« invalidation du cache », ce qu’il faut mettre en cache, le « read-through vs write-through vs write-back », l’« éviction du cache » (LRU/LFU/TTL), « Redis vs Memcached », les « stale reads », ou rencontre des problèmes de « thundering herd », de « cache stampede », de « cache penetration » ou de « hot key », ou choisit une politique d’éviction Redis `maxmemory` (allkeys-lru, volatile-lru, noeviction) plutôt qu’une expiration TTL pour les sessions ou d’autres données mises en cache. Utilisez-la dès qu’une architecture sollicite davantage les lectures ou qu’un datastore est surchargé par celles-ci, même si l’utilisateur ne parle pas de « cache ».

Add to TypingMind

Présentation

Éditeurproyecto26
Dépôtsystem-design-skills
Nom de la compétencecaching
Étoiles
117
Forks
14
Fichiers inclus
5
LicenceMIT
Liens
  • Instructions en Markdown

    Un fichier SKILL.md que le modèle charge à la demande : il ne consomme donc des tokens que lorsqu’une demande correspond réellement à la compétence.

  • Compatible avec tous les LLM

    Les compétences IA sont rédigées en Markdown et non sous forme de code propre à un fournisseur. Elles fonctionnent donc avec GPT, Claude, Gemini, Grok ou un modèle local.

  • Fichiers inclus : 5

    Des scripts, des gabarits et des références que le modèle peut consulter pendant son travail. Les fichiers sont en lecture seule et ne sont jamais exécutés.

  • Open source

    Publiée par proyecto26 sur GitHub. Consultez les sources avant de l’installer.

Installation

Installez la compétence IA Caching dans TypingMind pour l’utiliser avec n’importe quel LLM, ou ajoutez-la à un autre agent capable de lire SKILL.md.

1

Installer dans TypingMind

TypingMind installe une compétence directement depuis son dossier GitHub : l’application lit SKILL.md, regroupe les fichiers de ressources et enregistre le tout localement.

  1. Ouvrez l’application et accédez à Plugins → Compétences.
  2. Choisissez « Installer depuis GitHub ».
  3. Copiez l’URL ci-dessous, qui pointe vers le dossier de la compétence, puis collez-la et confirmez.
    https://github.com/proyecto26/system-design-skills/tree/main/skills/caching
  4. Activez la compétence dans chaque discussion où vous souhaitez pouvoir l’utiliser.
Plugins → Compétences → Ajouter une compétence → Via une URL GitHub, puis collez l’URL du dossier et appuyez sur Continuer.
2

Installer dans un autre agent

Tout agent capable de lire le format Agent Skills peut utiliser cette compétence : copiez le dossier dans le répertoire des compétences de cet agent.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/proyecto26/system-design-skills.git /tmp/system-design-skills
mkdir -p .claude/skills
cp -r /tmp/system-design-skills/skills/caching .claude/skills/caching
Redémarrez Claude Code après la copie pour que la nouvelle compétence soit prise en compte.

Utilisez cette compétence dans TypingMind

Activez Caching dans n’importe quelle discussion TypingMind et le modèle s’occupe du reste. Le nom et la description de la compétence figurent dans le prompt système. Dès qu’une demande correspond, le modèle charge lui-même l’intégralité des instructions : vous n’avez jamais à l’invoquer manuellement, et elle ne consomme aucun token tant qu’elle n’est pas utilisée.

Le modèle charge automatiquement Caching dès qu’une demande correspond à cette compétence.

Compatible avec tous les modèles IA

Les compétences IA sont de simples instructions Markdown, et non du code propre à un fournisseur. Ainsi, la compétence Caching n’est pas liée au modèle pour lequel elle a été conçue. Installez-la une seule fois dans TypingMind et utilisez-la avec GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama ou un modèle local que vous exécutez vous-même, le tout avec vos propres clés API.

  • Chargée uniquement en cas de besoin

    Le prompt système ne contient que le nom et la description. Les instructions sont récupérées à la première demande correspondante : une compétence inutilisée ne coûte donc rien.

  • Changez de modèle en cours de discussion

    La compétence étant constituée d’instructions et non de code, elle reste fonctionnelle lorsque vous changez de modèle : le nouveau modèle lit le même fichier SKILL.md.

Instructions de la compétence

Voici le contenu de SKILL.md que le modèle charge. Lisez-le avant l’installation : une compétence contient des instructions que votre modèle suivra.

Caching

Put a copy of hot data closer to the reader so most requests skip the slow path. Caching is the highest-leverage move for read-heavy systems — and the easiest to get subtly wrong, because a cache adds a second source of truth that can serve stale or wrong data, and can amplify an outage when it misbehaves.

When to reach for this

Reads dominate (a high read:write ratio from back-of-the-envelope); the same data is read repeatedly; the datastore is the read bottleneck; or recomputation is expensive. A cache buys read latency and offloads the origin.

When NOT to

Write-heavy or read-once data (low hit rate — pure overhead). Data that must be exactly current with zero staleness (a cache is a stale copy by nature; when strict freshness is required, go to the source or use consistency-coordination). Don't add a cache before a number shows reads are the problem (YAGNI) — it's a new failure mode and a second thing to operate.

Clarify first

  • Read:write ratio and hit rate — is the working set cacheable? (→ back-of-the-envelope, 80/20.)
  • Staleness tolerance — seconds? minutes? must reads see their own writes?
  • Working-set size — does the hot set fit in RAM across cache nodes?
  • Consistency on write — can the cache briefly disagree with the store?
  • Eviction trigger — what's the access pattern (recency? frequency? time-bound?).

The options

Where to cache (often layered): client/browser → CDN edge (→ content-delivery) → application/in-process → distributed cache (Redis/Memcached) → database buffer pool. This skill focuses on the application and distributed layers.

Read strategy

  • Cache-aside (lazy): app checks cache, on miss reads the store and populates. Use when reads are unpredictable; the default for most systems.
  • Read-through: the cache library fetches from the store on miss. Use to keep app code simple and caching policy centralized.

Write strategy

  • Write-through: write cache and store synchronously. Use when reads right after writes must be fresh and slower writes are acceptable.
  • Write-back (write-behind): write cache now, flush to store async. Use for write-heavy/bursty paths that tolerate a small loss window.
  • Write-around: write only the store; let the cache fill on read. Use when written data is rarely re-read soon (avoids cache churn).

Eviction policy

  • LRU for recency-skewed access (most common); LFU for stable popularity; TTL to bound staleness; FIFO rarely. Match the policy to the pattern.

Trade-offs

OptionWhat it solvesWhat it worsensChange it when
Cache-asideSimple, resilient (cache down ⇒ just slower)First read per key is a miss; risk of stale after writesMisses are too costly → read-through + warming
Read-throughCentralized, clean app codeCouples app to cache lib; cold-start missesCustom per-key load logic is needed
Write-throughFresh reads after writeSlower writes; writes cached data that may never be readWrites dominate and aren't re-read → write-around/back
Write-backFast, absorbs write burstsData loss window on crash; complexDurability of recent writes is required
Write-aroundNo churn from write-only dataRecently written keys miss on first readThat data IS read right after write → write-through
TTL evictionBounds staleness automaticallyMass expiry can stampede the originAdd jitter / soft-TTL refresh

Behavior under stress

A cache that misbehaves doesn't just stop helping — it can take down the origin.

  • Thundering herd / stampede: a hot key expires (or the cache restarts) and thousands of concurrent misses hit the store at once. Mitigate: per-key locks / request coalescing (single-flight), early/probabilistic refresh, TTL jitter.
  • Cache penetration: requests for keys that don't exist bypass the cache every time (often malicious). Mitigate: cache the negative result (short TTL), or a Bloom filter in front.
  • Hot key: one key (a celebrity, a viral item) exceeds a single node's throughput. Mitigate: replicate the key across nodes, add a local/L1 tier, or shard the value.
  • Eviction storm / cold cache: after a flush or deploy, hit rate craters and the origin sees full load. Mitigate: warm critical keys; ramp traffic.
  • Stale-after-write: the store changed but the cache didn't. Mitigate: invalidate on write, or write-through, or short TTL — pick per staleness budget.

Monitor: hit rate, p99 latency, eviction rate, key distribution (hot spots), and origin QPS during cache restarts.

How to apply

  1. Clarify the inputs — confirm the read:write ratio, staleness budget, and hot-set size (see Clarify first). If no number yet shows reads are the bottleneck, stop — a cache is not needed yet (→ back-of-the-envelope).
  2. Pick the strategies from the trade-off table — choose a read strategy (cache-aside is the default), a write strategy keyed to the staleness budget, and an eviction policy matched to the access pattern.
  3. Set the key knobs — define the key naming scheme, TTL (with jitter), and the per-key-family invalidation event. Decide negative-caching and single-flight up front, not after the first incident.
  4. Stress-test the choice — walk each failure in Behavior under stress (stampede, penetration, hot key, cold cache, stale-after-write) and confirm a mitigation is in place for the ones the traffic profile can trigger.
  5. Size it with numbers — fit the hot set in RAM across nodes, sanity-check the target hit rate (90%+), and confirm the node count covers peak QPS (→ Numbers that matter).
  6. Pick a provider — default to the generic recipe; only open a provider file if the user named a cloud (see Choosing a provider).
  7. Show the trade-off in the answer — give a Decision | Solves | Worsens | Change it when… table with one row per choice you made here (e.g. the option, its store, its failure policy); the last column is a concrete trigger (a number or observable signal). Then name what breaks first.

Dos and don'ts

Do

  • Default to cache-aside; it stays correct (just slower) when the cache is down.
  • Set a TTL on every entry and add jitter so keys don't expire in lockstep.
  • Add single-flight / request coalescing for hot keys before launch.
  • Invalidate on write (or write-through, or short TTL) to a stated staleness budget.
  • Size the cache to the hot set and alert on hit rate, evictions, and origin QPS.

Don't

  • Don't add a cache before a number proves reads are the bottleneck (YAGNI).
  • Don't cache data that must be exactly current — go to the source instead.
  • Don't let a mass-expiry or cold start dump full load on the origin (warm, ramp).
  • Don't ignore non-existent-key floods — cache negatives or front with a Bloom filter.
  • Don't reuse a key across schema versions — bump the version (...:v2) instead.

Numbers that matter

A cache node serves ~100k–1M QPS, far above an RDBMS (~1k). Memory access is ~100 ns vs ms-scale disk — the reason caching wins. Size the cache to the hot set (~20% of data ≈ 80% of reads). Target hit rates are usually 90%+; below that, question whether the data is cacheable. → back-of-the-envelope.

Interface sketch

A cache entry is a contract: a key (stable, namespaced, e.g. user:123:profile), a value (serialized; watch size), and a TTL. Decide the invalidation event per key family (on write? on TTL? on version bump?). Versioned keys (...:v2) make invalidation a write of a new key instead of a delete race.

Choosing a provider

Default to the generic recipe above (Redis or Memcached, self-hosted or managed). If the user names a cloud, read references/providers/<provider>.md for the managed-service mapping, limits, and provider-specific trade-offs. If no file exists for that provider, the generic recipe is the answer.

Diagram

To visualize the cache-aside read path (app → cache → miss → origin → populate) or the stampede/fallback flow, use the in-plugin architecture-diagram skill — cache nodes use the cache color, the origin its store color, and the miss path a dashed arrow.

Related building blocks

  • content-delivery — pairs with this as the edge layer above it; CDN/edge caching for static and media (that concept lives there).
  • data-storage — depends on this as the origin a cache protects; its read replicas are an alternative to caching reads, and cache-node sharding mirrors its partitioning. (Consistent-hashing theory is owned by consistency-coordination.)
  • consistency-coordination — pairs with this when staleness is unacceptable and read-your-writes or stronger guarantees are required.
  • back-of-the-envelope — feeds into this skill: it supplies the read ratio and hot-set size that justify a cache.
  • resilience-failure — pairs with this; rate limiting and circuit breakers (owned there) help contain the retry storms a misbehaving cache can trigger.
  • system-design — owned-concept lives in the orchestrator: the reasoning loop, the trade-off method, and the ten failure modes.

References

  • references/deep-dive.md — invalidation patterns, single-flight/coalescing, consistent hashing for cache sharding, Redis vs Memcached internals, local (L1) + distributed (L2) tiers. Read when designing the cache layer in detail.
  • references/providers/{generic,aws,azure,gcp}.md — service mappings, limits, and pitfalls per environment.

Fichiers inclus

Le modèle lit ces fichiers à la demande lorsque la compétence est chargée. Ils sont accessibles en lecture et ne sont jamais exécutés.

Foire aux questions

À quoi sert la compétence IA Caching ?

Utilisez cette compétence lorsque l’utilisateur pose des questions sur une « caching strategy », l’« invalidation du cache », ce qu’il faut mettre en cache, le « read-through vs write-through vs write-back », l’« éviction du cache » (LRU/LFU/TTL), « Redis vs Memcached », les « stale reads », ou rencontre des problèmes de « thundering herd », de « cache stampede », de « cache penetration » ou de « hot key », ou choisit une politique d’éviction Redis `maxmemory` (allkeys-lru, volatile-lru, noeviction) plutôt qu’une expiration TTL pour les sessions ou d’autres données mises en cache. Utilisez-...

Pourquoi utiliser Caching sur TypingMind ?

Parce que vous l’installez une seule fois pour l’utiliser avec n’importe quel modèle. Caching se compose de simples instructions en Markdown plutôt que de code propre à un fournisseur. La même compétence fonctionne donc avec GPT-5, Claude, Gemini, Grok ou un modèle local, et vous pouvez changer de modèle en cours de discussion sans perturber son fonctionnement. TypingMind utilise vos propres clés API : vous payez donc directement les fournisseurs plutôt qu’un abonnement par siège, et vos compétences et discussions restent dans votre propre espace de stockage.

Comment installer Caching dans TypingMind ?

Dans TypingMind, ouvrez Plugins → Compétences → Installer depuis GitHub et collez https://github.com/proyecto26/system-design-skills/tree/main/skills/caching. TypingMind lit le fichier SKILL.md, regroupe les fichiers associés et installe le tout sous forme de compétence que vous pouvez activer pour chaque discussion.

Quels modèles d’IA peuvent utiliser Caching ?

N’importe quel modèle que vous connectez dans TypingMind. Les compétences IA sont de simples instructions en Markdown, et non du code propre à un fournisseur. GPT, Claude, Gemini, Grok et les modèles locaux peuvent donc tous charger cette compétence lorsqu’une demande lui correspond.

Combien de modèles d’IA puis-je utiliser avec Caching ?

Autant que vous le souhaitez. Vous pouvez utiliser Caching avec tout modèle qui prend en charge les compétences : GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama et bien d’autres, le tout dans TypingMind avec vos propres clés API.

La compétence IA Caching est-elle gratuite ?

Oui. Cette compétence est publiée sur GitHub par proyecto26 sous licence MIT. Vous ne payez que votre propre fournisseur d’IA pour les tokens utilisés.

Que sont les compétences IA ?

Une compétence IA est un ensemble d’instructions réutilisables qui apprend à un modèle d’IA à accomplir une tâche précise. Elle suit le format ouvert Agent Skills : un fichier SKILL.md contenant un nom et une description, ainsi que les éventuels scripts, gabarits ou fichiers de référence dont le modèle peut avoir besoin. Le modèle ne lit les instructions que lorsque votre demande correspond à la compétence. Une compétence installée ne coûte donc rien tant qu’elle n’est pas utilisée.

En quoi les compétences IA diffèrent-elles des plugins ou des serveurs MCP ?

Un plugin ou un serveur MCP fournit au modèle de nouveaux outils à appeler : du code qui s’exécute quelque part et renvoie un résultat. Une compétence IA lui apporte plutôt des connaissances et une méthode : comment aborder une tâche, quelles étapes suivre et à quoi ressemble un bon résultat. Les compétences sont de simples instructions en Markdown. Elles ne nécessitent donc ni serveur, ni clé API, ni environnement d’exécution, et fonctionnent avec n’importe quel modèle.

Tout voir

Créez votre propre espace de travail IA dès maintenant

Abonnez-vous à notre newsletter pour être informé des nouvelles fonctionnalités et des prochains cadeaux à gagner 👇