@Override
    public Optional<RawConfig> getConfig(RawConfig input, JRTServerConfigRequest request) {
        // Always add to delayed responses (we remove instead if we find config in cache)
        // This is to avoid a race where we might end up not adding to delayed responses
        // nor subscribing to config if another request for the same config
        // happens at the same time
        DelayedResponse delayedResponse = new DelayedResponse(request);
        delayedResponses.add(delayedResponse);

        ConfigCacheKey configCacheKey = new ConfigCacheKey(input.getKey(), input.getDefMd5());
        Optional<RawConfig> cachedConfig = memoryCache.get(configCacheKey);
        boolean needToGetConfig = true;

        if (cachedConfig.isPresent()) {
            RawConfig config = cachedConfig.get();
            log.log(Level.FINE, () -> "Found config " + configCacheKey + " in cache, generation=" + config.getGeneration() +
                    ",config checksums=" + config.getPayloadChecksums());
            log.log(Level.FINEST, () -> "input config=" + input + ",cached config=" + config);
            if (ProxyServer.configOrGenerationHasChanged(config, request)) {
                log.log(Level.FINEST, () -> "Cached config is not equal to requested, will return it");
                if (delayedResponses.remove(delayedResponse)) {
                    // unless another thread already did it
                    return cachedConfig;
                }
            }
            if (!config.isError() && config.getGeneration() > 0) {
                needToGetConfig = false;
            }
        }
        if (needToGetConfig) {
            subscribeToConfig(input, configCacheKey);
        }
        return Optional.empty();
    }
Retrieves the requested config from the cache or the remote server.
<p>
If the requested config is different from the one in cache, the cached request is returned immediately.
If they are equal, this method returns null.
<p>
If the config was not in cache, this method starts a <em>Subscriber</em> in a separate thread
that gets the config and calls updateSubscribers().

@param input The config to retrieve - can be empty (no payload), or have a valid payload.
@return A Config with a payload.
config-proxy/src/main/java/com/yahoo/vespa/config/proxy/RpcConfigSourceClient.java