Uses Redis from Go in this stack (go-redis, env-based address, Docker service name redis). Use when implementing caching, URL storage, TTL, or Pub/Sub, or when the user mentions Redis, REDIS_ADDR, or keys for this project.
REDIS_ADDR (Compose sets redis:6379 inside the network; local non-Docker may use 127.0.0.1:6379).github.com/redis/go-redis/v9 — create one redis.Client (or cluster as needed), reuse it across handlers; close on shutdown if the process exits cleanly.r.Context() (or a root context) for Ping, Get, Set, Del, etc., so requests cancel correctly.url:{code} or short:{code}) → : destination URL string; optional with / options if links should expire.EXSetSET NX (or check-then-set in a transaction) depending on consistency needs.404 for unknown short codes).REDIS_ADDR changes. Do not hardcode hostnames except via env defaults for dev.