GETSET

Since 1.1.0Strings

Syntax

GETSET key value
  • Flags: fast, write
  • ACL categories: @fast, @string, @write
  • Arity: 3

Sets key to value and returns the value it held before, in one step. The key's expiry is removed. SET key value GET does the same.

Reply

  • The old value, or nil if the key did not exist.

Examples

> SET a 1
OK
> GETSET a new
"1"
> GET a
"new"