backend-caching-strategies

backend-caching-strategies is a skill for Claude Code, Codex from j4flmao/agent-skills. It costs 138 tokens per session (2,520 once invoked), scanned A, original, MIT.

Guidance for storing application data in Redis, an in-memory data store, so repeated reads can be served quickly. It explains cache-aside and write-through patterns and ways to remove outdated entries.

In plain words
What is it for?
Designing Redis-backed reads and writes, loading missing values from a database, updating the cache, and expiring or deleting changed data.
Why use it?
It helps prevent stale cached data and clarifies how an application should behave when the cache has or does not have a value.

Skill for Claude CodeCodex

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

Good fit Designing Redis-backed reads and writes, loading missing values from a database, updating the cache, and expiring or deleting changed data.

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

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

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

Your own site · 80×15
<a href="https://agentmods.dev/skills/j4flmao/agent-skills/caching-strategies"><img src="https://agentmods.dev/badge/skills/j4flmao/agent-skills/caching-strategies.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 138 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,520 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.00138 $0.02520
Opus 5.5 $0.00055 $0.01008
Sonnet 5.5 $0.00028 $0.00504
Haiku 4.5 $0.00014 $0.00252

Measured yesterday against content hash d316102519ef, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

backend-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 yesterday.

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/backend/caching-strategies/SKILL.md · 225 lines

How it starts

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

Caching Strategies with Redis

Purpose

Choose the right application-level caching pattern for a data access path and implement it so that the cache never becomes a source of wrong answers or outages. Covers read/write patterns, invalidation, stampede protection, and behaviour when Redis is unavailable.

Agent Protocol

Trigger

Exact user phrases: "cache-aside", "write-through", "write-behind", "read-through", "cache invalidation", "redis cache pattern", "cache stampede", "thundering herd", "TTL jitter", "stale cache".

Input Context

  • Read/write ratio and acceptable staleness for the data.
  • Source of truth (PostgreSQL, MySQL, remote API) and who writes to it.
  • Language/client library (go-redis v9, ioredis/node-redis, redis-py, Lettuce).
  • Single Redis, Sentinel, or Cluster.

Output Artifact

Pattern choice with rationale plus code for read path, write path and invalidation. No files unless requested.

Response Format

Data: {entity / query}
Pattern: {cache-aside | read-through | write-through | write-behind}
Key: {key template}   TTL: {base} + jitter {range}
Invalidation: {delete-on-write | versioned key | event-driven}
Stampede guard: {singleflight | lock | early refresh | none}
Redis down: {fall through to DB | serve stale | fail}

Pattern Selection

Pattern Read path Write path Consistency Use when
Cache-aside App reads cache, on miss loads DB and populates App writes DB, then deletes key Eventual; short stale window Default for most read-heavy data
Read-through Cache layer/library loads on miss Same as cache-aside Same as cache-aside You want loading logic centralised in a cache wrapper
Write-through Cache always populated App writes DB and cache in the same request Stronger, but two writes can diverge on partial failure Data read immediately after write, small hot set
Write-behind Cache is primary Write to cache, flush to DB asynchronously Risk of data loss if cache dies before flush Counters, metrics, write-coalescing where loss is tolerable
Refresh-ahead Background refresh before expiry n/a Fresh for hot keys Predictable hot keys with expensive loads

Read the full file on GitHub · 225 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. yesterday Changed · +170 lines · +119 tokens per session d316102519ef
  2. 1mo ago First seen · 55 lines · 19 tokens per session scan A 689f1e529e52

Subscribe to this mod's changes

backend-caching-strategies is a skill published in the GitHub repository j4flmao/agent-skills (35 stars, last pushed yesterday), licensed MIT. It adds 138 tokens to every session and 2,520 once invoked, about $0.0006 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-30.

Related

Other skills, from other repositories