Redis

Installation
SKILL.md

Expiration (Memory Leaks)

  • Keys without TTL live forever—set expiry on every cache key: SET key value EX 3600
  • Can't add TTL after SET without another command—use SETEX or SET ... EX
  • EXPIRE resets on key update by default—SET removes TTL; use SET ... KEEPTTL (Redis 6+)
  • Lazy expiration: expired keys removed on access—may consume memory until touched
  • SCAN with large database: expired keys still show until cleanup cycle runs

Data Structures I Underuse

  • Sorted sets for rate limiting: ZADD limits:{user} {now} {request_id} + ZREMRANGEBYSCORE for sliding window
  • HyperLogLog for unique counts: PFADD visitors {ip} uses 12KB for billions of uniques
  • Streams for queues: XADD, XREAD, XACK—better than LIST for reliable queues
  • Hashes for objects: HSET user:1 name "Alice" email "a@b.com"—more memory efficient than JSON string

Atomicity Traps

Installs
1
First Seen
Jun 20, 2026