caching-strategies

caching-strategies is a skill for Claude Code from arjunprabhulal/devops-skills. It costs 134 tokens per session (1,613 once invoked), scanned A, original, MIT.

A guide to caching, which keeps copies of data closer to where it is requested so repeated reads can be faster. It covers when cached data may be out of date and how to keep copies consistent.

In plain words
What is it for?
Choosing data worth caching, selecting cache-aside, write-through, or write-behind designs, setting expiry times, invalidating entries after updates, and preventing cache stampedes.
Why use it?
It helps avoid making a system faster at the cost of quietly showing incorrect information. It addresses expiry, updates, and many requests arriving when the same cached item expires.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the devops-skills plugin — 56 skills shipped together

Good fit Choosing data worth caching, selecting cache-aside, write-through, or write-behind designs, setting expiry times, invalidating entries after updates, and preventing cache stampedes.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/arjunprabhulal/devops-skills/caching-strategies
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 arjunprabhulal/devops-skills --skill caching-strategies
Clone the repo
git clone --depth 1 https://github.com/arjunprabhulal/devops-skills

Made for: Claude Code.

Or install devops-skills, the plugin that ships this one along with the rest of its 56 skills.

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-strategies

README.md
[![agentmods](https://agentmods.dev/badge/skills/arjunprabhulal/devops-skills/caching-strategies/github.svg)](https://agentmods.dev/skills/arjunprabhulal/devops-skills/caching-strategies)
Your own site
<a href="https://agentmods.dev/skills/arjunprabhulal/devops-skills/caching-strategies"><img src="https://agentmods.dev/badge/skills/arjunprabhulal/devops-skills/caching-strategies/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-strategies

Your own site · 80×15
<a href="https://agentmods.dev/skills/arjunprabhulal/devops-skills/caching-strategies"><img src="https://agentmods.dev/badge/skills/arjunprabhulal/devops-skills/caching-strategies.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 134 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,613 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.
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.00134 $0.01613
Opus 5 $0.00067 $0.00807
Sonnet 5 $0.00027 $0.00323
Haiku 4.5 $0.00013 $0.00161

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

Security

Grade A, and why

caching-strategies 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 9d 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.

skills/data/caching-strategies/SKILL.md · 124 lines

How it starts

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

Caching Strategies

Caching is one of the few changes that can make a system both faster and more fragile in the same commit. It is easy to add and easy to get subtly wrong, and the failure mode is rarely a crash — it is a user seeing data that is quietly, plausibly wrong, which is far harder to notice and debug than an error.

The decision to cache something is really two decisions: is this worth the complexity, and am I willing to accept the staleness this introduces. Skipping the second question is how caches turn into a source of bugs instead of a source of speed.

A cache without an explicit invalidation and staleness story is not an optimization — it is a bet that nobody will notice when the data is wrong.

1. Cache what is expensive and read-heavy, not everything

Every cached value is a second copy of the truth that can drift from the source, so caching should be reserved for data where the read cost or read frequency actually justifies that risk.

  • Cache results that are expensive to compute or fetch — aggregations, joins across services, external API calls — not simple key lookups that are already fast.
  • Cache data that is read far more often than it changes. A value read a thousand times between writes is a good candidate; a value read once per write gains little from caching.
  • Skip caching data with strict consistency requirements, like account balances or inventory counts at checkout, unless the invalidation story is airtight.

Done when: each cached value has a stated reason — read frequency, compute cost, or upstream latency — that justifies the staleness risk it introduces.

2. Pick the pattern that matches your consistency needs

The three common caching patterns trade off differently between read speed, write speed, and staleness risk, and picking the wrong one for the workload is a common source of both bugs and wasted engineering effort.

Pattern Reads Writes Risk
Cache-aside App checks cache, falls back to source, populates cache Simple, cache invalidated on write Cache can go stale if invalidation is missed
Write-through Always served from cache Written to cache and source together, in sync Write latency increases; cache always fresh
Write-behind Always served from cache Written to cache immediately, source asynchronously Fast writes; risk of data loss if cache fails before flush

Read the full file on GitHub · 124 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. 9d ago First seen · 124 lines · 134 tokens per session scan A d99177df9696

Subscribe to this mod's changes

caching-strategies is a skill published in the GitHub repository arjunprabhulal/devops-skills (3 stars, last pushed 15d ago), licensed MIT. It adds 134 tokens to every session and 1,613 once invoked, about $0.0007 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-08-31.

Related

Other skills, from other repositories

google-cloud-storage-fuse

Mounts Cloud Storage buckets as a POSIX file system with Cloud Storage FUSE (gcsfuse). Use when interacting with gcsfuse: decide whether FUSE, native gs:// reads, or Filestore/Managed Lustre fits a workload, deploy tuned mounts on GKE, Compute Engine, or Cloud Run, enable and size file, stat, and list caches, tune…

google/skills · 214 tokens

alloydb-basics

Manages clusters, instances, and backups for AlloyDB for PostgreSQL, and integrates with AlloyDB Model Context Protocol (MCP) tools for automated database operations. Use when creating, configuring, or administering AlloyDB databases. Do NOT use for general PostgreSQL instances (e.g. Cloud SQL) or other GCP databases.

google/skills · 72 tokens

bigquery-bigframes

Generates Python code using BigQuery DataFrames (BigFrames), the pandas/scikit-learn-style API over BigQuery. Use when writing BigFrames code or doing pandas-style dataframe/ML work against BigQuery (e.g. in a notebook). Don't use for SQL-first workflows or the google-cloud-bigquery client library — use…

google/skills · 76 tokens

bigtable-basics

Assists in provisioning instances/tables, designing performant schemas, and querying data in Bigtable. Use when designing Bigtable row keys, configuring column families, writing SQL queries or client library code (Java, Go, Python) for Bigtable, or diagnosing performance/hotspotting issues. Also use when provisioning…

google/skills · 87 tokens

cloud-databases-onboarding

Guides users through discovering their database requirements, recommends a Google Cloud database based on a recommendation matrix, and assists in database creation. Use when a user asks 'What database service should I use?', 'Help me pick a database', or when a user wants to create a new database on Google Cloud.…

google/skills · 83 tokens

cloud-sql-basics

This file generates or explains Cloud SQL resources. Use this file when the user asks to create a Cloud SQL instance or database for MySQL, PostgreSQL, or SQL Server. Cloud SQL manages third-party MySQL, PostgreSQL, and SQL Server instances as resources in Cloud SQL. For example, when Cloud SQL creates an open-source…

google/skills · 108 tokens