public class DefaultAuthoritativeDnsServerCache extends java.lang.Object implements AuthoritativeDnsServerCache
AuthoritativeDnsServerCache
, backed by a ConcurrentMap
.构造器和说明 |
---|
DefaultAuthoritativeDnsServerCache()
Create a cache that respects the TTL returned by the DNS server.
|
DefaultAuthoritativeDnsServerCache(int minTtl,
int maxTtl,
java.util.Comparator<java.net.InetSocketAddress> comparator)
Create a cache.
|
限定符和类型 | 方法和说明 |
---|---|
void |
cache(java.lang.String hostname,
java.net.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(java.lang.String hostname)
Clears the cached nameservers for the specified hostname.
|
DnsServerAddressStream |
get(java.lang.String hostname)
Returns the cached nameservers that should be used to resolve the given hostname.
|
java.lang.String |
toString() |
public DefaultAuthoritativeDnsServerCache()
public DefaultAuthoritativeDnsServerCache(int minTtl, int maxTtl, java.util.Comparator<java.net.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(java.lang.String hostname)
AuthoritativeDnsServerCache
DnsServerAddressStream
may contain unresolved InetSocketAddress
es that will be resolved
when needed while resolving other domain names.get
在接口中 AuthoritativeDnsServerCache
hostname
- the hostnamenull
if none.public void cache(java.lang.String hostname, java.net.InetSocketAddress address, long originalTtl, EventLoop loop)
AuthoritativeDnsServerCache
cache
在接口中 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
public boolean clear(java.lang.String hostname)
AuthoritativeDnsServerCache
clear
在接口中 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 methodpublic java.lang.String toString()
toString
在类中 java.lang.Object