public URI discoverEndpoint(String key, boolean required, URI defaultEndpoint) {
        if (required) {
            try {
                return put(key, cacheLoader.load(key), defaultEndpoint);
            } catch (Exception e) {
                return defaultEndpoint;
            }
        }  else {
            loadAndScheduleRefresh(key, 1, defaultEndpoint);
            return defaultEndpoint;
        }
    }
Abstract method to be implemented by each service to handle storing endpoints
in it's cache. This method must schedule refresh of cache values whenever putting
a new endpoint into it's cache.

@param key - The cache key
@param endpointDetails - The details for an endpoint including the address and cache period.
@return The endpoint used for this request
aws-java-sdk-core/src/main/java/com/amazonaws/endpointdiscovery/EndpointDiscoveryRefreshCache.java