Latest web development tutorials

Redis PERSISTEN comando

Redis clave (key)

Redis PERSISTEN comando se utiliza para eliminar un tiempo de caducidad clave dada, por lo que la clave no caduca nunca.

gramática

Redis PERSISTEN sintaxis del comando básico es el siguiente:

redis 127.0.0.1:6379> PERSIST KEY_NAME

versiones disponibles

> = 2.2.0

Valor de retorno

Cuando el tiempo de caducidad ha eliminado correctamente, devuelve 1. Si la clave no existe o la clave no está establecido el tiempo de caducidad, se devuelve 0.

Ejemplos

redis> SET mykey "Hello"
OK

redis> EXPIRE mykey 10  # 为 key 设置生存时间
(integer) 1

redis> TTL mykey
(integer) 10

redis> PERSIST mykey    # 移除 key 的生存时间
(integer) 1

redis> TTL mykey
(integer) -1

Redis clave (key)