redis-best-practices

Installation
SKILL.md

Redis Best Practices

Rules for code that talks to Redis, on any deployment. They come from real support cases and from tests on two engines:

  • Stock Redis: Redis 8 with default settings and the client on the same machine, so no network cost.
  • Upstash Redis: with the client in the same region, about 1 ms away.

Engines differ. Stock Redis runs commands on one main thread, so one slow command stalls every client. Valkey, managed services and Upstash change some defaults and limits. Rules below apply everywhere unless they name an engine, and On Upstash collects what differs there.

Decide what the database is

  • Cache: eviction on, and a TTL on every key.
  • Store: eviction off, backups on, and a size limit raised before it is hit.

Half the trouble in support comes from databases that are neither, growing until writes fail or keys vanish. A cache with no expirations and a high miss rate only grows.

Know the eviction policy. Open source Redis defaults to noeviction, which fails writes at the limit, and some managed services default to volatile-lru. For a pure cache, use allkeys-lru or allkeys-lfu, but remember they delete keys you may not be able to reload. volatile-* policies only evict keys with a TTL, so a store without TTLs frees nothing. Eviction is sampled and approximate, so keep headroom. A database pinned at its limit evicts all day.

Batch with the right command

Installs
28
Repository
upstash/skills
GitHub Stars
34
First Seen
3 days ago