cache-redis

Enforces Redis key naming, TTL, cache-aside, locking, and rate-limiting rules.

Updated Aug 22, 2026
One-click install
npx skills add https://github.com/balajirags/aifsd-kit --skill cache-redis-balajirags
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: cache-redis
Source: https://github.com/balajirags/aifsd-kit/tree/main/docs/skills/cache-redis
Command: npx skills add https://github.com/balajirags/aifsd-kit --skill cache-redis-balajirags

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Teams using Redis often ship subtle correctness bugs: keys without TTLs that leak memory, non-atomic counters that race under concurrency, locks released with a plain DEL that delete someone else's lock, and Pub/Sub used for messages that must not be lost. This Skill encodes the rules that prevent those failures. ## Core Features & Use Cases - Key and TTL discipline: Mandates the <app>:<env>:<entity>:<id> key format and requires an expiry on every cache key. - Concurrency-safe patterns: Covers cache-aside reads, distributed locks with TTL plus unique owner ID and atomic Lua-based release, and atomic rate limiting via Lua scripts or pipelined transactions. - Durability and eviction guidance: Explains when Pub/Sub is acceptable versus Kafka/Streams, and how to choose maxmemory-policy per use case. - Use Case: While implementing a Spring service, a developer applies the cache-aside pattern with @Cacheable/@CacheEvict and uses a Redisson lock with tryLock and a TTL to guard a reservation workflow. ## Quick Start Review my Redis caching and locking code against the cache-redis rules and flag any violations.

Frequently Asked Questions about cache-redis

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

FAQPage Schema
How do I implement a distributed lock in Redis safely?

A distributed lock must carry a TTL so a crashed holder cannot block it forever, plus a unique lock ID so you only release locks you own. Release via an atomic check-and-delete Lua script, never a plain DEL, which could delete another owner's lock.

How to implement cache-aside pattern with Redis and Spring?

Cache-aside reads the cache first, falls back to the database on a miss, then writes the result back with a TTL. In Spring, use @Cacheable for reads and @CacheEvict for writes, as shown in the skill's examples.

When should I use Redis Pub/Sub vs Kafka?

Redis Pub/Sub is not durable: a disconnected subscriber loses messages permanently. Use it only for best-effort signals like cache invalidation broadcasts, and use Kafka or Redis Streams when delivery must be guaranteed, such as order events.

Why is GET then SET unsafe for Redis rate limiting?

Reading then writing a counter as two round trips races under concurrent requests, allowing requests to interleave and exceed the limit. Use INCR, SET with NX, or an atomic Lua script or pipelined transaction instead.

Which Redis maxmemory-policy should I choose?

Use allkeys-lru or allkeys-lfu for pure caches, volatile-lru when only some keys carry a TTL, and noeviction for session or lock data where silent key loss would be a correctness bug rather than a cache miss.