SET
StringsSet string value for a key
Options & Flags
Available options for this command
EXSet expiry in seconds
PXSet expiry in milliseconds
NXOnly set if key doesn't exist
XXOnly set if key exists
Examples
Common usage examples
Set simple string value
SET mykey "Hello"Set with 1 hour expiry
SET session:123 "data" EX 3600Create lock with 30s expiry
SET lock:resource "1" NX EX 30Notes
- Overwrites existing value by default