public class DefaultAuthoritativeDnsServerCache extends Object implements AuthoritativeDnsServerCache
AuthoritativeDnsServerCache
, backed by a ConcurrentMap
.Constructor and Description |
---|
DefaultAuthoritativeDnsServerCache()
Create a cache that respects the TTL returned by the DNS server.
|
DefaultAuthoritativeDnsServerCache(int minTtl,
int maxTtl,
Comparator<InetSocketAddress> comparator)
Create a cache.
|
Modifier and Type | Method and Description |
---|---|
void |
cache(String hostname,
InetSocketAddress address,
long originalTtl,
EventLoop loop)
Caches a nameserver that should be used to resolve the given hostname.
|
void |
clear()
Clears all cached nameservers.
|
boolean |
clear(String hostname)
Clears the cached nameservers for the specified hostname.
|
DnsServerAddressStream |
get(String hostname)
Returns the cached nameservers that should be used to resolve the given hostname.
|
String |
toString() |
public DefaultAuthoritativeDnsServerCache()
public DefaultAuthoritativeDnsServerCache(int minTtl, int maxTtl, Comparator<InetSocketAddress> comparator)
minTtl
- the minimum TTLmaxTtl
- the maximum TTLcomparator
- the Comparator
to order the InetSocketAddress
for a hostname or null
if insertion order should be used.public DnsServerAddressStream get(String hostname)
AuthoritativeDnsServerCache
DnsServerAddressStream
may contain unresolved InetSocketAddress
es that will be resolved
when needed while resolving other domain names.get
in interface AuthoritativeDnsServerCache
hostname
- the hostnamenull
if none.public void cache(String hostname, InetSocketAddress address, long originalTtl, EventLoop loop)
AuthoritativeDnsServerCache
cache
in interface AuthoritativeDnsServerCache
hostname
- the hostnameaddress
- the nameserver address (which may be unresolved).originalTtl
- the TTL as returned by the DNS serverloop
- the EventLoop
used to register the TTL timeoutpublic void clear()
AuthoritativeDnsServerCache
clear
in interface AuthoritativeDnsServerCache
AuthoritativeDnsServerCache.clear(String)
public boolean clear(String hostname)
AuthoritativeDnsServerCache
clear
in interface AuthoritativeDnsServerCache
true
if and only if there was an entry for the specified host name in the cache and
it has been removed by this methodCopyright © 2008–2024 The Netty Project. All rights reserved.