Glossary

Redis

Redis (REmote DIctionary Server) is an in-memory data store that keeps data in RAM for very low-latency reads and writes, optionally persisting it to disk. Created by Salvatore Sanfilippo in 2009, it's most often used as a cache, a message queue, a rate limiter, or a session store sitting in front of a slower primary database.

How it works

Unlike a plain key-value cache, Redis supports several native data structures per key: strings, lists, hashes (field-value maps), sets, sorted sets (scored, range-queryable), streams, and bitmaps. A single Redis instance's core command execution is single-threaded, so individual commands — including multi-step ones like INCR — are atomic without extra locking. Persistence is optional and configurable: RDB takes periodic point-in-time snapshots, while AOF (append-only file) logs every write for finer-grained durability; many deployments run without either, treating Redis as a pure, disposable cache.

Clients connect using a redis:// URI (or rediss:// for TLS), which encodes host, port (default 6379), optional password, and database index:

redis://:mypassword@cache.example.com:6379/0
rediss://user:pass@cache.example.com:6380/1

Common pitfalls

  • Redis without persistence loses all data on restart — fine for a cache, disastrous if something started relying on it as a system of record.
  • Storing very large values (multi-MB strings) or unbounded collections in a single key can block the single-threaded event loop for other clients while it's processed.
  • KEYS * scans the entire keyspace and blocks the server on large datasets — use SCAN for iteration in production.
  • A missing EXPIRE/TTL on cache keys turns a cache into a slow memory leak that only shows up once RAM runs out.

Related terms

  • JSON — the common serialization format for values stored in Redis hashes or strings, since Redis itself only stores structures, not object schemas.
  • Unix timestamp — commonly stored alongside a value to compute or set expirations manually.

See also