String

SET

Set a key to hold a string value.

Arguments

keybodystringrequired

The key

valuebodyTValuerequired

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

optsbodyobject

You can pass a few options to the command.

Response

required

"OK"

Basic
await redis.set("my-key", {my: "value"});
Expire in 60 seconds
await redis.set("my-key", {my: "value"}, {  ex: 60});
Only update
await redis.set("my-key", {my: "value"}, {  xx: true});
Loading search…