GETDEL

Syntax

  1. GETDEL key

Time complexity: O(1)

Get the value of key and delete the key. This command is similar to GET, except for the fact that it also deletes the key on success (if and only if the key’s value type is a string).

Return

Bulk string reply: the value of key, nil when key does not exist, or an error if the key’s value type isn’t a string.

Examples

  1. dragonfly> SET mykey "Hello"
  2. "OK"
  3. dragonfly> GETDEL mykey
  4. "Hello"
  5. dragonfly> GET mykey
  6. (nil)