home / skills / partme-ai / full-stack-skills / redis

redis skill

/skills/redis

This skill provides comprehensive guidance on Redis usage, covering data structures, commands, pub/sub, persistence, clustering, and caching patterns.

npx playbooks add skill partme-ai/full-stack-skills --skill redis

Review the files below or copy the command above to add this skill to your agents.

Files (2)
SKILL.md
672 B
---
name: redis
description: Provides comprehensive guidance for Redis including data structures, commands, pub/sub, persistence, clustering, and caching patterns. Use when the user asks about Redis, needs to use Redis for caching, implement Redis data structures, or work with Redis features.
license: Complete terms in LICENSE.txt
---

## When to use this skill

Use this skill whenever the user wants to:
- [待完善:根据具体工具添加使用场景]

## How to use this skill

[待完善:根据具体工具添加使用指南]

## Best Practices

[待完善:根据具体工具添加最佳实践]

## Keywords

[待完善:根据具体工具添加关键词]

Overview

This skill provides comprehensive, practical guidance for using Redis across common development needs: data structures, commands, pub/sub, persistence, clustering, and caching patterns. It focuses on actionable recipes, recommended commands, and configuration guidance to help you design efficient, reliable Redis-backed systems. Use it when you need to implement caching, real-time features, or advanced Redis data structures in production or development.

How this skill works

The skill inspects the user’s Redis use case and recommends specific data structures (strings, lists, sets, sorted sets, hashes, streams) and commands optimized for that scenario. It explains persistence options (RDB, AOF), eviction policies, replication and clustering setup, and patterns for caching, rate limiting, messaging, and leader election. The guidance includes command examples, configuration tips, trade-offs, and troubleshooting steps for performance and durability.

When to use it

  • Implementing caching layers to reduce database load and latency
  • Designing real-time features like pub/sub messaging or streams
  • Choosing Redis data structures for specific application needs
  • Configuring persistence, replication, or cluster topology for production
  • Implementing rate limiting, job queues, or leader election

Best practices

  • Prefer the right data structure for intent — e.g., lists for queues, sorted sets for leaderboards, hashes for compact objects
  • Use TTLs and appropriate eviction policies for cache keys to avoid memory bloat
  • Enable AOF and/or RDB based on recovery needs; test recovery scenarios regularly
  • Monitor memory usage and keyspace with INFO and establish alerts for high memory pressure
  • Shard data with Redis Cluster for horizontal scaling and use replica nodes for read scaling

Example use cases

  • Cache database query results with predictable TTLs and cache invalidation patterns
  • Build a real-time leaderboard using sorted sets with score updates and range queries
  • Implement a distributed rate limiter using INCR and EXPIRE atomically
  • Create a reliable task queue with lists or streams and consumer groups for processing
  • Set up pub/sub for instant notifications and use streams when message durability is required

FAQ

Is Redis durable enough for primary data storage?

Redis is primarily an in-memory datastore with optional persistence (RDB/AOF). For critical primary storage, combine AOF with replicas and accept the trade-offs or use Redis only for ephemeral or cached data and keep a durable database for source-of-truth.

When should I use Redis Cluster vs a single instance with replicas?

Use Redis Cluster when you need horizontal write scaling and larger dataset capacity beyond single-node memory. Use a single master with replicas for simpler setups where dataset fits one node and read scaling or failover are the main needs.