redis-patterns

Implement Redis caching, locking, and rate limiting for Spring Boot.

3|2|Updated Jan 16, 2026
One-click install
npx skills add https://github.com/taipt1504/agent-skills --skill redis-patterns-taipt1504
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: redis-patterns
Source: https://github.com/taipt1504/agent-skills/tree/main/skills/redis-patterns
Command: npx skills add https://github.com/taipt1504/agent-skills --skill redis-patterns-taipt1504

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Provides production-oriented Redis patterns and checklist guidance to prevent cache inconsistency, data loss, and operational outages when using Redis in Java Spring Boot (MVC and WebFlux) applications. It consolidates cache-aside, eviction, serialization, distributed locking, rate limiting, pub/sub, streams, and cluster configuration best practices so teams avoid common anti-patterns like no TTL, KEY scans, and hot keys.

Core Features & Use Cases

  • Cache Consistency & Performance: TTL strategies, eviction on writes, serializer recommendations, cache stampede protection, and write-behind/write-through tradeoffs for both reactive and blocking code.
  • Distributed Coordination: Redisson and RedisTemplate locking patterns, atomic unlock via Lua, fair/read-write lock options, and lock TTL/lease management for order processing and critical sections.
  • Rate Limiting & Atomic Scripts: Full Lua rate-limiter script example and WebFlux filter integration for per-client limits and headers.
  • Messaging & Streams: Pub/Sub with SSE examples, Redis Streams producer/consumer with consumer groups and trimming, suitable for event-driven workflows and durable queues.
  • Cluster & HA Guidance: Sentinel and Cluster configuration, hash tag key design for multi-key operations, connection pooling, and Testcontainers examples for integration testing.

Quick Start

Use the redis-patterns skill to implement a reactive cache-aside with a 30 minute TTL, configure serializer and eviction rules, and add a Redisson-based distributed lock for critical order updates.

Frequently Asked Questions about redis-patterns

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

FAQPage Schema
How do I implement distributed locking in Spring Boot with Redis?

Implement distributed locking in Spring Boot using Redisson or RedisTemplate patterns. This ensures atomic unlock via Lua scripts and manages lock TTL/lease for critical sections like order processing.

How do I prevent cache stampedes in a Spring Boot Redis cache-aside pattern?

Prevent cache stampedes in a Redis cache-aside pattern by applying TTL strategies, write-behind tradeoffs, and explicit eviction on writes. This protects both reactive WebFlux and blocking MVC services.

How do I build a Lua-based rate limiter for reactive Spring Boot WebFlux?

Build a Lua-based rate limiter for reactive Spring Boot WebFlux by executing atomic Lua scripts and integrating WebFlux filters. This enforces per-client limits and returns appropriate headers.

How do I configure Redis Streams consumer groups for event-driven Spring Boot workflows?

Configure Redis Streams consumer groups in Spring Boot by setting up producers and consumers with trimming. This enables durable queues and event-driven workflows alongside pub/sub SSE examples.

Does this Redis pattern guidance support Sentinel and Cluster deployments?

Yes, this guidance supports Sentinel and Cluster deployments by providing connection options, pooling, and cluster-aware hash tags. This ensures multi-key operations work correctly in HA environments.

How do I test Redis Spring Boot configurations using Testcontainers?

Test Redis Spring Boot configurations using Testcontainers examples for integration testing. This validates cache-aside patterns, serializer rules, and cluster setups before production deployment.