Redis Renamenx command - Lệnh rename Key trong Redis

Redis RENAMENX command được sử dụng để rename tên của key nếu tên này chưa được sử dụng.

Return value:

Integer reply:

Syntax:

redis 127.0.0.1:6379> RENAMENX OLD_KEY_NAME NEW_KEY_NAME

Ví dụ:

#First, create some keys in Redis and set some values in it.

redis 127.0.0.1:6379> SET tutorial1 redis
OK
redis 127.0.0.1:6379> SET tutorial2 mongodb
OK

#Now, rename the key ‘tutorial1’ to ‘new-tutorial’.

redis 127.0.0.1:6379> RENAMENX tutorial1 new-tutorial
(integer) 1
redis 127.0.0.1:6379> RENAMENX tutorial2 new-tutorial
(integer) 0

Revision #2
Created 13 October 2019 04:50:18 by Laptrinh.vn
Updated 11 April 2020 15:22:12 by Laptrinh.vn