Command Groups
Redis organizes commands into the following groups:Data Structure Commands
String Commands
GET, SET, INCR, DECR, APPEND - Work with string values
List Commands
LPUSH, RPUSH, LPOP, LRANGE - Manage ordered collections
Set Commands
SADD, SMEMBERS, SINTER - Handle unique unordered collections
Sorted Set Commands
ZADD, ZRANGE, ZRANK - Manage sorted collections with scores
Hash Commands
HSET, HGET, HGETALL - Store field-value pairs
Stream Commands
XADD, XREAD, XGROUP - Process append-only logs
System Commands
Generic Commands
DEL, EXISTS, EXPIRE - Work with keys of any type
Server Commands
INFO, CONFIG, SAVE - Manage server operations
Pub/Sub Commands
PUBLISH, SUBSCRIBE - Implement messaging patterns
Cluster Commands
CLUSTER NODES, CLUSTER SLOTS - Manage cluster topology
Scripting Commands
EVAL, EVALSHA, SCRIPT LOAD - Execute Lua scripts
Command Properties
Each Redis command has specific properties that affect its behavior:Time Complexity
All commands document their computational complexity using Big O notation:- O(1): Constant time - operations like GET, SET
- O(N): Linear time - operations like DEL with multiple keys
- O(log N): Logarithmic time - operations on sorted sets like ZADD
- O(N*M): Combined complexity - operations like SINTER
Command Flags
Commands are marked with flags indicating their characteristics:- READONLY: Does not modify data
- WRITE: Modifies data
- FAST: Executes in constant or logarithmic time
- DENYOOM: Denied when memory is full
- STALE: Can run on stale replicas
ACL Categories
Commands belong to ACL categories for access control:- KEYSPACE: Key management operations
- STRING: String data type operations
- LIST: List data type operations
- SET: Set data type operations
- SORTEDSET: Sorted set operations
- HASH: Hash data type operations
- STREAM: Stream data type operations
- PUBSUB: Publish/Subscribe operations
- SCRIPTING: Lua scripting
- DANGEROUS: Potentially dangerous operations
Command Naming Conventions
Redis follows consistent naming patterns:Prefix Patterns
- L/R: Left/Right operations (LPUSH, RPUSH)
- B: Blocking variants (BLPOP, BRPOP)
- P: Pattern-based operations (PSUBSCRIBE)
- X: Stream operations (XADD, XREAD)
- Z: Sorted set operations (ZADD, ZRANGE)
- H: Hash operations (HSET, HGET)
- S: Set operations (SADD, SMEMBERS)
Suffix Patterns
- BY: Sort or compare (SORT, ZRANGEBYSCORE)
- STORE: Store result (SINTERSTORE)
- LEN: Get length (STRLEN, LLEN)
- NX/XX: Conditional operations (only if Not eXists / only if eXists)
Using the Command Reference
Each command page includes:- Syntax: Complete command syntax with all options
- Parameters: Detailed parameter descriptions
- Return Value: What the command returns
- Time Complexity: Performance characteristics
- Examples: Practical usage with redis-cli
- History: Version changes and new features
Quick Reference
Most Common Commands
| Command | Group | Purpose |
|---|---|---|
| GET | String | Retrieve string value |
| SET | String | Store string value |
| DEL | Generic | Delete keys |
| EXISTS | Generic | Check key existence |
| EXPIRE | Generic | Set key expiration |
| LPUSH | List | Add to list head |
| SADD | Set | Add to set |
| ZADD | Sorted Set | Add to sorted set |
| HSET | Hash | Set hash field |
| XADD | Stream | Add stream entry |
Command History
Redis commands evolve over versions. Key milestones:- Redis 1.0.0: Core data structures (strings, lists, sets)
- Redis 2.0.0: Hashes, pub/sub
- Redis 2.6.0: Lua scripting (EVAL)
- Redis 2.8.0: Pattern scanning (SCAN)
- Redis 3.0.0: Redis Cluster
- Redis 3.2.0: GEO commands
- Redis 5.0.0: Streams (XADD, XREAD)
- Redis 6.0.0: ACL system
- Redis 7.0.0: Redis Functions
Best Practices
Performance Tips
- Use SCAN instead of KEYS for production key iteration
- Pipeline multiple commands to reduce round trips
- Avoid blocking commands in high-throughput applications
- Use appropriate data structures for your use case
- Set expiration times to manage memory automatically
Security Considerations
- Enable ACLs to restrict command access
- Avoid DANGEROUS category commands in user-facing applications
- Validate input before passing to EVAL scripts
- Use connection limits to prevent resource exhaustion
Getting Help
Redis provides built-in help:Next Steps
Generic Commands
Learn key management operations
String Commands
Master the most common data type