Redis is an in-memory data structure store used as a database, cache, and message broker. Its key mental model is that every key maps to exactly one data type and commands are valid only for that type. Redis 8 (GA 2025) unified what was previously Redis Stack β adding JSON, Time Series, Bloom filters, probabilistic structures, and the new Vector Set type (beta) directly into Redis Open Source. Day-to-day success with Redis comes from choosing the right structure (e.g., sorted sets for leaderboards, streams for event logs, vector sets for semantic search) and using safe key iteration (SCAN) plus explicit expiry (EXPIRE). Treat Redis as a long-running server you secure (ACL/TLS) and observe (INFO, SLOWLOG) rather than "just a library."
What This Cheat Sheet Covers
This topic spans 16 focused tables and 270 indexed concepts, 92 flashcards. Below is a complete table-by-table outline of this topic, spanning foundational concepts through advanced details.
A jump-to index of every table row in this cheat sheet.
An interactive map of every table and concept in this topic.
Table 1: Setup and Introspection
The commands you reach for first β connecting with redis-cli, confirming the server is alive, and peering into how it is configured and what it is doing. INFO, CONFIG GET/SET, and CLIENT LIST are your everyday windows into a running instance, and most config keys here can be changed live without a restart.
| Concept | Example | Description | |
|---|---|---|---|
redis-cli -h 127.0.0.1 -p 6379 | Connects to a Redis server from the command line. | ||
PING | Health check β returns PONG if server is reachable. | ||
AUTH default myPassword | Authenticates the current connection (username optional for single-password setup). | ||
SELECT 1 | Switches to a logical database (0β15 by default). | ||
DBSIZE | Returns number of keys in the currently selected database. | ||
INFO memory | Returns server stats and state, optionally filtered by section. | ||
CONFIG GET maxmemory | Reads effective runtime configuration values. | ||
CONFIG SET maxmemory 1073741824 | Changes supported runtime configuration without restart. | ||
CLIENT LIST | Lists connected clients and metadata for each connection. | ||
HELLO 3 | Switches protocol mode and returns server/connection info (use 3 for RESP3). | ||
FLUSHDB ASYNC | Deletes all keys in the current database asynchronously. | ||
SWAPDB 0 1 | β’ Atomically swaps two logical databases β’ fast and safe in-place swap. | ||
LASTSAVE | Returns UNIX timestamp of last successful RDB save. | ||
redis-server --version | Installs Redis and verifies the server binary is available. | ||
maxmemory 1gb maxmemory-policy allkeys-lru | Defines Redis runtime configuration settings. |