CodeVetter · Repo Unpack · Feature catalog
redis/redis
User-facing surface is the RESP command set — 464 JSON command specs under `src/commands/` compiled into the 13k-line `src/commands.def`. Alongside the classic types (string/list/set/zset/hash/stream/HLL/geo/bitmap) this tree adds a first-class array type (AR* commands), key-blessing (BLESS), hot-key tracking (HOTKEYS), INCREX, hash-field expiration (HEXPIRE family), and a compiled-out GCRA rate limiter. Administrative surface spans ACL, CLIENT, CLUSTER (including atomic slot migration), CONFIG, FUNCTION, DEBUG, and the Sentinel command set. Client-side tooling ships as `redis-cli` (with a full cluster manager and ~60 flags), `redis-benchmark`, and the two check tools.
- 464 command specification JSON files under `src/commands/` are the declarative source of the command table; `utils/generate-command-code.py` compiles them into `src/commands.def` (13,236 lines) via the `$(COMMANDS_DEF_FILENAME).def` Make rule.
- A new `OBJ_ARRAY` (type 7) sparse-array data type is exposed via 18 commands — ARSET, ARGET, ARDEL, ARDELRANGE, ARGETRANGE, ARGREP, ARINFO, ARINSERT, ARLASTITEMS, ARLEN, ARMGET, ARMSET, ARNEXT, AROP, ARRING, ARSCAN, ARSEEK, ARCOUNT — implemented in `src/t_array.c` over `src/sparsearray.c`.
- BLESS marks keys as never-evictable: the NO-EVICT bit lives in the kvBits byte after each kvobj, persists through RDB and AOF, and is exposed as BLESS SET/GET/CLEAR/SCAN plus an `blessed_keys` INFO counter backed by a per-DB `db->blessed_keys` index.
- HOTKEYS START/STOP/GET/RESET/HELP expose a CuckooHeavyKeeper top-K sketch (`src/chk.c`, based on the Ngo & Papatriantafilou paper plus a min-heap borrowed from RedisBloom's TopK) that can be scoped to specific cluster slot ranges via a `slotRangeArray`.
- INCREX is a new string command returning a two-element reply (`{value, applied}`) that creates a missing key at 0 before incrementing, with an optional increment argument.
- Hash-field expiration ships as eight commands — HEXPIRE, HEXPIREAT, HPEXPIRE, HPEXPIREAT, HEXPIRETIME, HPEXPIRETIME, HGETEX, HGETDEL — backed by the `ebuckets` radix-of-buckets expiry structure and the per-DB `estore` subexpires store.
- A GCRA (Generic Cell Rate Algorithm) leaky-bucket rate limiter exists as `src/gcra.c` with an `OBJ_GCRA` object type and a 4-arg `GCRA key max_burst tokens_per_period period` command, ported from redis-cell — but it is compiled out by default behind `#ifdef ENABLE_GCRA`.
- Atomic slot migration is a user-facing cluster feature driven by `CLUSTER MIGRATION IMPORT <slots>` run on the destination node, handled by `clusterMigrationCommand()`, with an eight-step protocol documented in the file header.
- Lua scripting is offered in two forms: ephemeral EVAL/EVALSHA/SCRIPT via `evalGenericCommand()` and `luaCreateFunction()` in `src/eval.c`, and persistent FUNCTION libraries via a pluggable engine registry in `src/functions.c` whose only registered engine is `LUA_ENGINE_NAME` from `src/function_lua.c`.
- `redis-cli` is a large multi-mode tool (11,561 lines) exposing analysis modes `--bigkeys --memkeys --hotkeys --keystats-samples --scan --latency --latency-dist --latency-history --intrinsic-latency --lru-test --rdb --functions-rdb --pipe --replica --eval --ldb`, RESP3/JSON output modes, and TLS flags (`--tls --cert --key --cacert --cacertdir --insecure`).
- `redis-cli --cluster` embeds a full cluster manager dispatch table of `clusterManagerCommandProc` functions — create, add-node, del-node, info, check, fix, reshard, rebalance — with ~25 `--cluster-*` option flags.
- Sentinel is a distinct operating mode of the same binary: `initSentinelConfig()` + `initSentinel()` run before config parsing so the config file populates monitored-master state, and `sentinelIsRunning()` replaces the normal ready-to-serve path in `main()`.
- Multi-threaded IO is a runtime feature with its own event loops per thread: `initThreadedIO()` is called from `InitServerLast()`, and `readQueryFromClient()` branches on `server.io_threads_num > 1` and atomically tracks `c->pending_read` and per-thread `IOThreads[c->running_tid].io_reads_processed`.
- Client/replication payload compression is a user-visible option: `clientCompressionProcessPendingData()` runs in `beforeSleep()`, clients carry a `compression_state` and `CLIENT_IO_COMPRESSION_ENABLED` io_flag, and `setReplCompression(server.repl_compression)` is forced off at init when the build lacks zstd.
- `modules/vector-sets/` is an in-tree module (deliberately absent from modules.yaml) implementing HNSW vector search with its own `commands.json`, `hnsw.c`, an expression filter language in `expr.c`, and a word2vec helper `w2v.c`.