if (o instanceof WMSCapabilities)
return (WMSCapabilities) o;
// The cache entry exists, but is not a Capabilities document. Attempt to parse the Capabilities docuemnt,
// by treating the current cache entry as a source.
WMSCapabilities caps = parseCapabilities(o, name);
if (caps == null)
return null;
// If the parsing succeeded, then overwrite the existing cache entry with the newly created Capabilities.
cache.put(cacheKey, caps);