Redis comando PTTL
Redis comando PTTL en milisegundos regresar el tiempo de caducidad restante clave.
gramática
Redis PTTL sintaxis del comando básico es el siguiente:
redis 127.0.0.1:6379> PTTL KEY_NAME
versiones disponibles
> = 2.6.0
Valor de retorno
Cuando no existe la clave, devuelve -2. Cuando la llave está presente, pero no establece el tiempo de vida restante, devuelve -1. De lo contrario, el tiempo de supervivencia restante, en milisegundos, la tecla de retorno.
Nota: 2.8 Redis atrás, cuando la clave no existe o no está configurado tiempo de vida restante clave, el comando devuelve -1.
Ejemplos
# 不存在的 key redis> FLUSHDB OK redis> PTTL key (integer) -2 # key 存在,但没有设置剩余生存时间 redis> SET key value OK redis> PTTL key (integer) -1 # 有剩余生存时间的 key redis> PEXPIRE key 10086 (integer) 1 redis> PTTL key (integer) 6179