public function getTtl($key)
    {
        $getResult = $this->getValue($key);
        $unserialized = @unserialize($getResult);

        if (!Util::hasInternalExpireTime($unserialized)) {
            throw new \Exception('Cannot retrieve ttl');
        }

        return $this->handleTtl($key, $unserialized['ts'], $unserialized['s']);
    }
public function getTtl($key)
    {
        $getResult = $this->getValue($key);
        $unserialized = @unserialize($getResult);

        if (!Util::hasInternalExpireTime($unserialized)) {
            throw new \Exception('Cannot retrieve ttl');
        }

        return $this->handleTtl($key, $unserialized['ts'], $unserialized['s']);
    }
public function getTtl ( $ key ) { $ getResult = $ this -> getValue ( $ key ) ; $ unserialized = @ unserialize ( $ getResult ) ; if ( ! Util :: hasInternalExpireTime ( $ unserialized ) ) { throw new \ Exception ( 'Cannot retrieve ttl' ) ; } return $ this -> handleTtl ( $ key , $ unserialized [ 'ts' ] , $ unserialized [ 's' ] ) ; }
Returns the remaining time to live of a key that has a timeout.

@param string $key

@return int Ttl in seconds.

@throws KeyNotFoundException
@throws \Exception
Returns the remaining time to live of a key that has a timeout .