redis-patterns
Installation
SKILL.md
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 tasks '{"type":"email"}' |
| Recent items | List (capped) | LPUSH + LTRIM |
| Real-time messaging | Pub/Sub | PUBLISH events '{"type":"deploy"}' |
| Event log | Stream | XADD events * type deploy organ IV |