Commands.app

SET

Strings

Set string value for a key

Options & Flags
Available options for this command
EX

Set expiry in seconds

PX

Set expiry in milliseconds

NX

Only set if key doesn't exist

XX

Only 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 3600

Create lock with 30s expiry

SET lock:resource "1" NX EX 30
Notes
  • Overwrites existing value by default
Related Commands
You might also find these useful