X-Git-Url: https://git.saurik.com/redis.git/blobdiff_plain/924aa408b99837036b679bd3895f836af6bc763f..12ebe2ac17a26ecf263f90b2acdf03db29b00223:/doc/GetsetCommand.html diff --git a/doc/GetsetCommand.html b/doc/GetsetCommand.html index e1d8d538..1726bccc 100644 --- a/doc/GetsetCommand.html +++ b/doc/GetsetCommand.html @@ -16,7 +16,7 @@
-GetsetCommand: Contents
  GETSET _key_ _value_
    Return value
    Design patterns
    See also +GetsetCommand: Contents
  GETSET _key_ _value_
    Return value
    Design patterns

GetsetCommand

@@ -26,11 +26,9 @@
-

GETSET _key_ _value_

+ #sidebar StringCommandsSidebar

GETSET _key_ _value_

Time complexity: O(1)
GETSET is an atomic set this value and return the old value command.Set key to the string value and return the old value stored at key.The string can't be longer than 1073741824 bytes (1 GB).

Return value

Bulk reply

Design patterns

GETSET can be used together with INCR for counting with atomic reset whena given condition arises. For example a process may call INCR against thekey mycounter every time some event occurred, but from time totime we need to get the value of the counter and reset it to zero atomicallyusing GETSET mycounter 0.
-

See also

-