PERSIST command
PERSIST KEY
用于移除给定 key 的过期时间,设置key永不过期。如果过期时间被成功移除,返回1,如果键不存在或者键本来就是永久的,则返回0。
Operation example:
Call the PERSIST command 3 times, once because the key expiration time is successfully removed, it returns 1, the second time because the key is deleted, so it returns 0, and the third time because the key is permanent, so it also returns 0 .
SET command
SET key value
设置指定 key 的值
Operation example: It
can be found that after using the set command, the key expiration time is cleared.
GETSET command
GETSET key value
设置key的值为value ,并返回key的旧值,如果key没有旧值,也就是key不存在时,返回nil。
Operation example: It
can be found that after using the getset command, the expiration time of the key is cleared.
EXPIRE command
EXPIRE key time
设置键的过期时间
Operation example: It
can be found that after the expire command is used, the expiration time is reset.