Set a key to hold a string value.
The key
The value, if this is not a string, we will use JSON.stringify to convert it to a string.
JSON.stringify
You can pass a few options to the command.
Show child attributes
Instead of returning "OK", this will cause the command to return the old value stored at key, or null when key did not exist.
"OK"
null
Adds an expiration (in seconds) to the key.
Adds an expiration (in milliseconds) to the key.
Expires the key after the given timestamp (in seconds).
Expires the key after the given timestamp (in milliseconds).
Keeps the old expiration if the key already exists.
Only set the key if it does not already exist.
Only set the key if it already exists.
Was this page helpful?