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