redis-patterns
Redis Patterns teaches you to leverage Redis for caching, real-time messaging, rate limiting, and distributed coordination. Learn data structure selection, cache invalidation strategies, stampede prevention, and session storage through working code examples and anti-patterns to avoid.
Redis Patterns shows you how to implement caching, pub/sub messaging, rate limiting, and distributed locks effectively.
AI-generated summary based on this skill's SKILL.md
Install
organvm/a-i--skills/redis-patterns · repository language: Python
git clone https://github.com/organvm/a-i--skills
cp -r a-i--skills/skills/development/redis-patterns ~/.claude/skills/redis-patternsnpx skillfed install organvm/a-i--skills/redis-patternsFrequently asked questions
AI-generated answers based on this skill's SKILL.md and metadata
How do I implement redis caching in my application?
Redis Patterns covers multiple caching strategies including cache-aside, write-through, and write-behind patterns. The skill teaches you to store frequently accessed data in Redis, validate cache hits before database queries, and implement expiration strategies to keep your cache fresh. You'll learn how to prevent cache stampedes when popular keys expire and design TTL policies for different data types.
What are the best redis data structures for scalability?
Redis Patterns guides you through selecting the right data structures—strings, hashes, lists, sets, and sorted sets—based on your access patterns and scalability needs. The skill covers key naming conventions that support sharding, efficient memory usage through structure choice, and how different structures impact query performance. You'll learn to optimize for both read/write throughput and memory footprint.
How can I build rate limiting and distributed locking with Redis?
Redis Patterns teaches rate limiting via sliding window counters and token bucket algorithms, plus distributed lock implementation using SET with NX and expiration. You'll learn Lua scripting for atomic operations, preventing race conditions in multi-process environments, and handling lock timeouts gracefully. The skill covers both simple and advanced locking patterns for coordinating access across distributed systems.
How to use redis for pub/sub messaging and events?
Redis Patterns covers pub/sub channels for real-time message broadcasting and Redis Streams for durable, consumer-group-based event processing. You'll learn when to choose each approach, how to build event-driven architectures, and implement message ordering and replay. The skill includes patterns for handling subscriber failures and ensuring reliable message delivery in production systems.
What redis patterns should I avoid in production?
Redis Patterns teaches anti-patterns including unbounded key growth, ignoring memory eviction policies, blocking operations on large datasets, and poor Lua script design. You'll learn why synchronous blocking calls hurt performance, how inadequate expiration strategies lead to memory bloat, and common mistakes in cluster configuration. The skill emphasizes best practices to prevent these pitfalls.
How do I manage sessions and message queues with Redis?
Redis Patterns covers session storage using hashes with appropriate TTLs, session invalidation strategies, and scaling session stores across instances. For message queues, you'll learn list-based queues for simple cases and Redis Streams for complex workflows requiring consumer groups, acknowledgments, and message history. The skill teaches durability considerations and recovery patterns.
SKILL.md
rendered from the published skill — quoted content, verbatim
Redis Patterns
Effective patterns for caching, messaging, and distributed coordination with Redis.
Data Structure Selection
| Need | Structure | Example |
|---|---|---|
| Simple cache | String | SET user:123 '{"name":"Jo"}' |
| Object fields | Hash | HSET user:123 name Jo email jo@x.com |
| Unique collection | Set | SADD online_users user:123 user:456 |
| Ranked items | Sorted Set | ZADD leaderboard 100 user:123 |
| Message queue | List | `LPUSH |
(truncated - see the full file via the links below)
Read as markdown · JSON record · Browse the source repository
File tree — 1 file
skills/development/redis-patterns/SKILL.md