public function validate($cache)
    {
        $original = $cache;

        // Make sure the cache is configured using a closure
        if (is_callable($cache)) {
            $failed = false;
            try {
                $cache = $cache($this->container);
            } catch (\Exception $e) {
                $failed = true;
                // Add a note to the log that we are unable to connect to the cache backend
                $this->container['log']->warning(
                    'Unable to connect to the cache backend.'
                );
            }

            // Return original closure if connection didn't fail and if
            // the cache is an instance of the Cache Contract
            if (!$failed && $cache instanceof CacheContract) {
                return $original;
            }
        } else {
            // Add a note to the log that the configuration must be updated
            $this->container['log']->warning(
                'A cache must be configured as a closure. See the documentation for more information.'
            );
        }

        // Return a NullCache as a fallback
        return function ($app) {
            return new NullCache();
        };
    }