private function normalizeTtl($ttl)
    {
        if ($ttl === null) {
            return self::DEFAULT_TTL; // Default TTL is one hour
        }

        if (\is_int($ttl)) {
            return $ttl;
        }

        if ($ttl instanceof DateInterval) {
            $currentDateTime = new \DateTimeImmutable();
            $ttlDateTime = $currentDateTime->add($ttl);

            return $ttlDateTime->getTimestamp() - $currentDateTime->getTimestamp();
        }

        throw new InvalidArgumentException('Invalid TTL: ' . print_r($ttl, true));
    }