Jamm\Memory\APCObject::getKeyTTL PHP Method

getKeyTTL() public method

Returns, how many seconds left till key expiring.
public getKeyTTL ( string $key ) : integer
$key string
return integer
    public function getKeyTTL($key)
    {
        $i = new \APCIterator('user', '/^' . preg_quote($this->prefix . $key) . '$/', APC_ITER_TTL + APC_ITER_CTIME, 1);
        $item = $i->current();
        if (empty($item)) {
            return NULL;
        }
        if ($item[self::apc_arr_ttl] != 0) {
            return $item[self::apc_arr_ctime] + $item[self::apc_arr_ttl] - time();
        } else {
            return self::max_ttl;
        }
    }