redis-patterns

redis-patterns is a skill for Claude Code, Codex from khalilbenaz/claude-skills-collection. It costs 56 tokens per session (1,926 once invoked), scanned A, original, MIT.

A guide to using Redis for fast temporary data, user sessions, messaging, durable queues, counters, rate limits, and rankings. Redis is an in-memory data store commonly used alongside an application database.

In plain words
What is it for?
Use it to design cache keys, session storage, publish/subscribe messaging, Redis Streams queues, rate limiting, deduplication, and leaderboards.
Why use it?
It helps choose the right Redis data structure and expiration policy instead of treating every use case as a simple cache.

Skill for Claude CodeCodex

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

Good fit Use it to design cache keys, session storage, publish/subscribe messaging, Redis Streams queues, rate limiting, deduplication, and leaderboards.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/khalilbenaz/claude-skills-collection/redis-patterns
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 redis-patterns
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 redis-patterns

README.md
[![agentmods](https://agentmods.dev/badge/skills/khalilbenaz/claude-skills-collection/redis-patterns/github.svg)](https://agentmods.dev/skills/khalilbenaz/claude-skills-collection/redis-patterns)
Your own site
<a href="https://agentmods.dev/skills/khalilbenaz/claude-skills-collection/redis-patterns"><img src="https://agentmods.dev/badge/skills/khalilbenaz/claude-skills-collection/redis-patterns/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 redis-patterns

Your own site · 80×15
<a href="https://agentmods.dev/skills/khalilbenaz/claude-skills-collection/redis-patterns"><img src="https://agentmods.dev/badge/skills/khalilbenaz/claude-skills-collection/redis-patterns.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 56 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,926 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.00056 $0.01926
Opus 5 $0.00028 $0.00963
Sonnet 5 $0.00011 $0.00385
Haiku 4.5 $0.00006 $0.00193

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

Security

Grade A, and why

redis-patterns 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 7d 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.

database-skills/redis-patterns/SKILL.md · 220 lines

How it starts

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

Redis Patterns

Workflow

1. Identifier le pattern adapté

Besoin Pattern Structure de données
Cache lecture Cache-aside / Write-through String, Hash
Session utilisateur Session store Hash + TTL
Communication asynchrone Pub/Sub Channel
File d'attente durable Streams Stream
Compteur / Rate limiting Incr atomique String
Classement Leaderboard Sorted Set
Déduplication / ensemble Membership Set
Comptage unique approx. HyperLogLog HLL

2. Concevoir le nommage des clés

Convention : {app}:{entité}:{id}:{sous-clé} — toujours en minuscules, séparateur :.

user:42:session          # session utilisateur
product:sku:A123:stock   # stock d'un produit
rate:api:ip:1.2.3.4      # compteur rate limit
stream:orders            # stream de commandes
leaderboard:weekly       # classement hebdo

Critères :

  • Longueur < 64 chars (impact mémoire des clés)
  • Jamais d'informations sensibles dans la clé elle-même
  • Préfixe par environnement si Redis partagé : prod:, staging:

3. Définir les TTL

# Cache applicatif : TTL court
SET product:sku:A123 '{"price":29.99}' EX 300

# Session : TTL glissant via EXPIRE à chaque accès
HSET user:42:session token abc123 role admin
EXPIRE user:42:session 3600

# Données de référence : TTL long ou absent (refresh manuel)
SET config:feature-flags '{"darkMode":true}' EX 86400

Politique d'éviction conseillée :

  • Cache pur → allkeys-lfu
  • Cache + données persistantes mixées → volatile-lfu
  • Jamais d'éviction → noeviction (monitoring mémoire obligatoire)
redis-cli CONFIG SET maxmemory-policy allkeys-lfu
redis-cli CONFIG SET maxmemory 2gb

4. Implémenter les patterns courants

Cache-aside (read-through manuel)
import redis, json

r = redis.Redis(host='localhost', port=6379, decode_responses=True)

def get_product(sku: str) -> dict:
    key = f"product:sku:{sku}"
    cached = r.get(key)
    if cached:
        return json.loads(cached)          # cache hit
    product = db.fetch_product(sku)        # fallback DB
    r.set(key, json.dumps(product), ex=300)
    return product

Read the full file on GitHub · 220 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. 7d ago First seen · 220 lines · 56 tokens per session scan A 1ab51b179868

Subscribe to this mod's changes

redis-patterns is a skill published in the GitHub repository khalilbenaz/claude-skills-collection (22 stars, last pushed 16d ago), licensed MIT. It adds 56 tokens to every session and 1,926 once invoked, about $0.0003 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