redis-best-practices

Implements Redis caching patterns, data structures, and high-availability configurations for key-value workloads.

Updated Jul 25, 2026
One-click install
npx skills add https://github.com/kaannakiin/turborepo_template --skill redis-best-practices-kaannakiin
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: redis-best-practices
Source: https://github.com/kaannakiin/turborepo_template/tree/main/.agents/skills/redis-best-practices
Command: npx skills add https://github.com/kaannakiin/turborepo_template --skill redis-best-practices-kaannakiin

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Designing Redis usage correctly is hard: poor key naming, missing TTLs, wrong data structures, and unhandled failover lead to memory bloat, cache stampedes, and outages. This Skill provides concrete, production-oriented guidance for every major Redis concern. ## Core Features & Use Cases - Data Structure Selection: Covers Strings, Hashes, Lists, Sets, Sorted Sets, and Streams with command examples for queues, leaderboards, activity feeds, and event streaming. - Caching Patterns: Implements cache-aside, write-through, tag-based invalidation, TTL jitter, and memory policies like allkeys-lru. - Reliability & Operations: Explains MULTI/EXEC transactions, Lua scripts for atomic rate limiting, replication, Sentinel, Cluster hash tags, RDB/AOF persistence, security hardening, and monitoring. - Use Case: When building an API rate limiter, use the included Lua script pattern to atomically increment counters and set expirations, avoiding race conditions under concurrent requests. ## Quick Start Ask the AI to design a Redis caching layer with proper key naming, TTLs, and cache-aside logic for your application's user profile endpoints.

Frequently Asked Questions about redis-best-practices

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I choose the right Redis data structure for my use case?

Use Strings for simple caching and counters, Hashes for multi-field objects, Lists for queues and activity feeds, Sets for unique collections and membership checks, Sorted Sets for leaderboards and time-series, and Streams for event logs with consumer groups.

How to implement a rate limiter with Redis?

Use a Lua script that atomically increments a counter key and sets an expiration on first increment, returning 0 when the limit is exceeded. Running it via EVAL guarantees atomicity, preventing race conditions that occur with separate INCR and EXPIRE commands.

Should I use Redis Sentinel or Redis Cluster for high availability?

Use Sentinel for automatic failover with a single primary and read replicas. Use Cluster when you need horizontal scaling, since it shards data across nodes automatically and supports hash tags to keep related keys in the same slot.

Why should I avoid the KEYS command in production Redis?

KEYS scans the entire keyspace and blocks the server on large datasets. Use SCAN with MATCH and COUNT options instead, which iterates incrementally without blocking other clients.

What Redis eviction policy should I use for caching?

Set maxmemory to a defined limit and use the allkeys-lru policy, which evicts the least recently used keys when memory is full. Always set TTLs on cache keys and add jitter to expiration times to prevent thundering herd on simultaneous expiry.