The Redis GETDEL command gets the value of a given key, then deletes that key. It’s similar to the GET command, except that it deletes the key on success (the GET command doesn’t delete the key – it only returns its value).
An error is returned if the value stored at key is not a string.
The GETDEL command was introduced in Redis 6.2.0.