Basic Commands in Redis

From the Redis cheat sheet ยท Installation & Basics ยท verified Jul 2026

Basic Commands

Essential Redis commands and operations

bash
# Connect to Redis
redis-cli

# Test connection
PING

# Set and get values
SET key "value"
GET key

# Set with expiration
SETEX key 60 "value"  # Expires in 60 seconds
TTL key              # Check time to live

# Delete key
DEL key
๐Ÿ”‘ All operations on keys are atomic
โšก O(1) complexity for most operations
๐Ÿ” Use SCAN instead of KEYS in production
๐Ÿ’พ Transactions with MULTI/EXEC

More Redis tasks

Back to the full Redis cheat sheet