Upstash Documentation

SET

Set a key to hold a string value.
1 min read

Arguments#

keystrrequired#

The key

valueTValuerequired#

The value, if this is not a string, we will use JSON.stringify to convert it to a string.

getbool#

Instead of returning True, this will cause the command to return the old value stored at key, or None when key did not exist.

exint#

Sets an expiration (in seconds) to the key.

pxint#

Sets an expiration (in milliseconds) to the key.

exatint#

Set the UNIX timestamp in seconds until the key expires.

pxatint#

Set the UNIX timestamp in milliseconds until the key expires.

keepttlbool#

Keeps the old expiration if the key already exists.

nxbool#

Only set the key if it does not already exist.

xxbool#

Only set the key if it already exists.

Response#