public function set($key, $value, $ttl = null)
    {
        \WildWolf\Cache\Validator::validateKey($key);
        \WildWolf\Cache\Validator::validateTtl($ttl);

        if ($ttl instanceof \DateInterval) {
            $expires = new \DateTime();
            $expires->add($ttl);
        } elseif (is_numeric($ttl)) {
            $expires = new \DateTime('now +' . $ttl . ' seconds');
        } else {
            $expires = null;
        }

        if (is_object($value)) {
            $value = clone $value;
        }

        $this->cache[$key] = [$value, $expires];
        return true;
    }