String

GETSET

Return the value of the specified key and replace it with a new value.

Arguments

keybodystrrequired

The key to get.

valuebodyAnyrequired

The new value to store.

Response

required

The response is the value stored at the key or None if the key doesn't exist.

Example
redis.set("key", "old-value")assert redis.getset("key", "newvalue") == "old-value"
Loading search…