Say I unlink a zset key and then zadd a value A to it. Is there any chance that the actual deletion is performed after the zadd command and unexpectedly remove the value A from the zset key? Or once the unlink command is executed, the old memory fragment is "unlinked" from the key so further commands are executed on the the new memory fragment, not affected by the deletion?

Comment From: oranagra

As you imagined the old memory of the key is unlinked from the database and is released later, but is already no longer part of the database. in other words, once the UNLINK command is executed, the value is no loner accessible, and any command working on that same key will come empty handed (in your example create a new zset). the only side effect is that the memory is reclaimed asynchronously, so INFO command may still show that memory being used.

Comment From: ldwnt

As you imagined the old memory of the key is unlinked from the database and is released later, but is already no longer part of the database. in other words, once the UNLINK command is executed, the value is no loner accessible, and any command working on that same key will come empty handed (in your example create a new zset). the only side effect is that the memory is reclaimed asynchronously, so INFO command may still show that memory being used.

I see, thank you for explanation~