package org.gcube.common.clients.cache;
import org.gcube.common.clients.delegates.DiscoveryDelegate;
/**
* A cross-service cache of endpoint addresses used by {@link DiscoveryDelegate}s.
*
*
* @author Fabio Simeoni
*
* @param the type of service addresses
*
* @see Key
* @see DiscoveryDelegate
*
*/
public interface EndpointCache {
/**
* Resets the cache for a given {@link Key}.
* @param key the key
* @throws IllegalArgumentException if the key is null
*/
void clear(Key key) throws IllegalArgumentException;
/**
* Returns the address cached for a given {@link Key}
* @param key the key
* @return the endpoint address, or null
if there is no endpoint address cached for the service
* @throws IllegalArgumentException if the key is null
*/
A get(Key key) throws IllegalArgumentException;
/**
* Caches an endpoint address for a given {@link Key}
* @param key the key
* @param address the address
* @throws IllegalArgumentException if the key or the address are null
*/
void put(Key Key,A address) throws IllegalArgumentException;
}