fungover / haze

Key-Value database that talks RESP
MIT License
8 stars 8 forks source link

Implement GETDEL #210

Closed robinalfengard closed 7 months ago

robinalfengard commented 7 months ago

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/

cmatlak commented 7 months ago

what will the difference be towards the DEL command?

robinalfengard commented 7 months ago

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"

cmatlak commented 7 months ago

Okay, I understand. Thanks for clarifying