Redis (Cache Layer)
Installation
SKILL.md
Redis (Cache Layer)
Redis as a cache layer in front of a primary datastore (PostgreSQL, etc.) — not as a source of truth.
Connection Setup
Node.js — ioredis (recommended over node-redis for cluster/sentinel support)
import Redis from "ioredis";
const redis = new Redis(process.env.REDIS_URL ?? "redis://localhost:6379", {
maxRetriesPerRequest: 3,
enableAutoPipelining: true,
});
redis.on("error", (err) => console.error("[redis] connection error", err));