Interface DnsCache
- All Known Implementing Classes:
DefaultDnsCache, NoopDnsCache
public interface DnsCache
A cache for DNS resolution entries.
-
Method Summary
Modifier and TypeMethodDescriptioncache(java.lang.String hostname, DnsRecord[] additionals, java.lang.Throwable cause, EventLoop loop) Cache the resolution failure for a given hostname.cache(java.lang.String hostname, DnsRecord[] additionals, java.net.InetAddress address, long originalTtl, EventLoop loop) Create a newDnsCacheEntryand cache a resolved address for a given hostname.voidclear()Clears all the resolved addresses cached by this resolver.booleanclear(java.lang.String hostname) Clears the resolved addresses of the specified host name from the cache of this resolver.java.util.List<? extends DnsCacheEntry> Return the cached entries for the given hostname.
-
Method Details
-
clear
void clear()Clears all the resolved addresses cached by this resolver.- See Also:
-
clear
boolean clear(java.lang.String hostname) Clears the resolved addresses of the specified host name from the cache of this resolver.- Returns:
trueif and only if there was an entry for the specified host name in the cache and it has been removed by this method
-
get
Return the cached entries for the given hostname.- Parameters:
hostname- the hostnameadditionals- the additional records- Returns:
- the cached entries
-
cache
DnsCacheEntry cache(java.lang.String hostname, DnsRecord[] additionals, java.net.InetAddress address, long originalTtl, EventLoop loop) Create a newDnsCacheEntryand cache a resolved address for a given hostname.- Parameters:
hostname- the hostnameadditionals- the additional recordsaddress- the resolved addressoriginalTtl- the TTL as returned by the DNS serverloop- theEventLoopused to register the TTL timeout- Returns:
- The
DnsCacheEntrycorresponding to this cache entry.
-
cache
DnsCacheEntry cache(java.lang.String hostname, DnsRecord[] additionals, java.lang.Throwable cause, EventLoop loop) Cache the resolution failure for a given hostname. Be aware this won't be called with timeout / cancel / transport exceptions.- Parameters:
hostname- the hostnameadditionals- the additional recordscause- the resolution failureloop- theEventLoopused to register the TTL timeout- Returns:
- The
DnsCacheEntrycorresponding to this cache entry, ornullif this cache doesn't support caching failed responses.
-