caching-strategies

caching-strategies is a skill for Claude Code, Codex from KraitDev/skiLL.Md. It costs 15 tokens per session (1,898 once invoked), scanned A, original, MIT.

A guide for using a cache such as Redis or Memcached to keep frequently read data in fast storage before requests reach the database.

In plain words
What is it for?
Use it to investigate read-heavy API endpoints, choose what to cache, set an acceptable time for stale data, and reduce database load after checking query performance.
Why use it?
It helps reduce slow responses and repeated database queries when many users read data that changes infrequently.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one. Also seen: mentions Codex.

Good fit Use it to investigate read-heavy API endpoints, choose what to cache, set an acceptable time for stale data, and reduce database load after checking query performance.

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

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

README.md
[![agentmods](https://agentmods.dev/badge/skills/kraitdev/skill.md/caching-strategies/github.svg)](https://agentmods.dev/skills/kraitdev/skill.md/caching-strategies)
Your own site
<a href="https://agentmods.dev/skills/kraitdev/skill.md/caching-strategies"><img src="https://agentmods.dev/badge/skills/kraitdev/skill.md/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/kraitdev/skill.md/caching-strategies"><img src="https://agentmods.dev/badge/skills/kraitdev/skill.md/caching-strategies.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 15 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,898 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.00015 $0.01898
Opus 5.5 $0.00006 $0.00759
Sonnet 5.5 $0.00003 $0.00380
Haiku 4.5 $0.00002 $0.00190

Measured 1mo ago against content hash a4e433ceaed1, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, 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 1mo 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/architecture/caching-strategies/SKILL.md · 201 lines

How it starts

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

Caching Strategies

Purpose

Databases are slow; caches are fast. This skill teaches teams to strategically cache frequently accessed data in fast storage (Redis, Memcached) to intercept requests before they hit the database, dramatically reducing latency and database load. Caching is NOT a substitute for proper database optimization.

When to use

  • System is experiencing high latency on read-heavy API endpoints
  • Database CPU/Memory usage is constantly peaking due to repeated queries
  • Designing a new system expecting massive read throughput
  • Content rarely changes but reads happen constantly

When NOT to use

  • Before optimizing database queries (optimize first, cache second)
  • For data that changes frequently or is highly personalized
  • When consistency is more important than performance
  • As a quick fix for poor application architecture

Inputs required

  • Slow query logs or endpoint metrics
  • Cache infrastructure (Redis, Memcached)
  • Read/write patterns of the data
  • Acceptable staleness window (TTL)

Workflow

  1. Identify Bottlenecks: Profile APIs to find read-heavy, slow-changing data (user profiles, static config, product catalogs)
  2. Measure Access Patterns: How often is data read vs. written? How large? How old can it be?
  3. Select Strategy:
    • Cache-Aside: App checks cache; on miss, fetches DB, writes cache
    • Write-Through: App writes to cache and DB simultaneously
    • Write-Behind: App writes to cache only; batch updates to DB later (use cautiously)
  4. Set Eviction Policy: Assign Time-To-Live (TTL) values based on business tolerance for stale data
  5. Handle Invalidation: Implement cache invalidation logic on mutations (UPDATE/DELETE)
  6. Prevent Stampedes: Implement caching locks or staggered TTLs to prevent multiple clients fetching from DB simultaneously when a key expires
  7. Add Monitoring: Track cache hit rates, eviction rates, and staleness

Rules

  • MUST treat cache as ephemeral (can disappear at any time)
  • MUST NOT cache highly personalized or sensitive data (PII) in shared caches
  • MUST ALWAYS implement fallback to primary data store on cache failure
  • MUST set TTL values (no infinite cache)
  • MUST invalidate cache on mutations (UPDATE, DELETE operations)
  • MUST use separate caches for different data types/sensitivity levels
  • MUST NOT use cache as source of truth

Read the full file on GitHub · 201 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. 1mo ago First seen · 201 lines · 15 tokens per session scan A a4e433ceaed1

Subscribe to this mod's changes

caching-strategies is a skill published in the GitHub repository KraitDev/skiLL.Md (6 stars, last pushed 4mo ago), licensed MIT. It adds 15 tokens to every session and 1,898 once invoked, about $0.0001 per session on Opus 5.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

flutter-dio-cache-interceptor-engineering

Use when adding, reviewing, debugging, testing, or tuning diocacheinterceptor in a Flutter or Dart Dio client. Covers CacheOptions, CachePolicy, HTTP revalidation, cache stores, offline fallback, authenticated-user key isolation, invalidation, platform compatibility, and 4.x migration. Trigger for stale Dio responses…

ariaramin/flutter-skills · 126 tokens

sql-query-optimization

Diagnoses and optimises slow SQL queries using EXPLAIN ANALYZE. Covers identifying bottlenecks (sequential scans, bad estimates, heap fetches), index strategy, query rewrites, and verification. Invoked when the user asks to optimize a query, fix a slow database query, or improve database performance.

soulcodex/agentic · 70 tokens

flutter-caching

Design, implement, review, debug, test, and measure production caching in Flutter/Dart apps across Android, iOS, Web, Windows, macOS, and Linux. Use when a Flutter task mentions caching, offline data, stale data, TTL, invalidation, request deduplication, cache keys, response storage, cache directories, HTTP…

ariaramin/flutter-skills · 143 tokens

ecommerce-caching

Improve store performance with a layered caching strategy — CDN edge caching, Redis application cache, and smart cart-aware invalidation.

finsilabs/awesome-ecommerce-skills · 28 tokens

caching-strategies

Design multi-tier caching architectures for web applications — cache-aside vs write-through vs write-behind, TTL design, cache invalidation, Redis patterns, CDN configuration, browser caching, and stampede prevention. Use when choosing a caching pattern, designing cache invalidation strategies, implementing Redis…

curiositech/windags-skills · 137 tokens

cache-strategy-invalidation-expert

Redis caching patterns, cache-aside, write-through, TTL strategies, and invalidation. Activate on: caching, Redis, cache invalidation, cache-aside, write-through, TTL, CDN cache, stale-while-revalidate. NOT for: CDN/reverse proxy setup (use api-gateway-reverse-proxy-expert), database query optimization (use…

curiositech/windags-skills · 86 tokens