Closed robinalfengard closed 7 months ago
what will the difference be towards the DEL command?
Only real difference is the return type after the executed command. DEL returns the number of keys removed and GETDEL returns the actual value of the KEY that is removed.
Example DEL: SET key1 "Hello" redis answer -> "OK" DEL key1 redis answer -> 1
Example GETDEL: SET key1 "Hello" redis answer -> "OK" GETDEL key1 redis answer -> "Hello"
Okay, I understand. Thanks for clarifying
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).
See example: https://redis.io/commands/getdel/