Command Categories
Commands are organized into the following categories based on their functionality:String Commands
String commands operate on simple key-value pairs where values are strings.- SET - Set the string value of a key with optional expiry
- GET - Get the value of a key
- ECHO - Echo the given string
- INCR - Increment the integer value of a key by one
Key Management Commands
Key management commands allow you to inspect, delete, and manage keys across the store.- DEL - Delete a key
- KEYS - Find all keys matching a pattern
- TYPE - Determine the type of value stored at a key
- EXPIRE - Set a key’s time to live (handled via SET command)
Stream Commands
Streams are append-only log data structures that support powerful blocking read operations.- XADD - Append a new entry to a stream
- XRANGE - Return a range of elements from a stream
- XREAD - Read data from one or multiple streams, with optional blocking
Transaction Commands
Transactions allow you to execute multiple commands atomically.- MULTI - Mark the start of a transaction block
- EXEC - Execute all commands issued after MULTI
- DISCARD - Discard all commands issued after MULTI
Connection Commands
- PING - Ping the server to check connectivity
- CONFIG - Get configuration parameters
- INFO - Get information and statistics about the server
Command Syntax
All commands follow the Redis protocol (RESP) format. Commands are case-insensitive, though this documentation uses uppercase for clarity.Example Usage
Return Values
Commands return different types of values:- Simple strings - Prefixed with
+, e.g.,+OK - Errors - Prefixed with
-, e.g.,-ERR invalid command - Integers - Prefixed with
:, e.g.,:1 - Bulk strings - Length-prefixed strings, e.g.,
$5\r\nHello\r\n - Arrays - Collections of other types, e.g.,
*2\r\n$3\r\nfoo\r\n$3\r\nbar\r\n - Null - Represented as
$-1\r\n