private function getExpiration($ttl) : int
    {
        if ($ttl === null) {
            return PHP_INT_MAX;
        }

        if (is_int($ttl)) {
            return time() + $ttl;
        }

        return (new DateTime())->add($ttl)->getTimestamp();
    }