ttl, pttl

PHP Redis

ttl, pttl

Description

Returns the time to live left for a given key, in seconds. If the key doesn't exist, FALSE is returned. pttl returns a time in milliseconds.

取得一个KEY已经存在的时间。如果这个KEY不存在,则返回FLASE。PTTL使用毫秒为单位。

Parameters

Key: key

Return value

Long, the time left to live in seconds.

Example
$redis->ttl('key');