English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
The Redis PERSIST command is used to remove the expiration time of the given key, making the key never expire.
The basic syntax of the redis PERSIST command is as follows:
redis 127.0.0.1:6379> PERSIST KEY_NAME
>= 2.2.0
When the expiration time is removed successfully, return 1 . If the key does not exist or the key does not have an expiration time, return 0 .
redis> SET mykey "Hello" OK redis> EXPIRE mykey 10 # Set expiration time for the key (integer) 1 redis> TTL mykey (integer) 10 redis> PERSIST mykey # Remove the expiration time of the key (integer) 1 redis> TTL mykey (integer) -1