Top Description Methods
io.netty.resolver.dns

public Interface DnsCache

Known Direct Implementers
io.netty.resolver.dns.DefaultDnsCache, io.netty.resolver.dns.NoopDnsCache
Imports
io.netty.channel.EventLoop, io.netty.handler.codec.dns.DnsRecord, java.net.InetAddress, java.util.List

A cache for DNS resolution entries.

Method Summary

Modifier and TypeMethod and Description
public DnsCacheEntry

Returns:

The DnsCacheEntry corresponding to this cache entry.
cache
(String
the hostname
hostname
,
DnsRecord[]
the additional records
additionals
,
InetAddress
the resolved address
address
,
long
the TTL as returned by the DNS server
originalTtl
,
EventLoop
the EventLoop used to register the TTL timeout
loop
)

Create a new DnsCacheEntry and cache a resolved address for a given hostname.

public DnsCacheEntry

Returns:

The DnsCacheEntry corresponding to this cache entry, or null if this cache doesn't support caching failed responses.
cache
(String
the hostname
hostname
,
DnsRecord[]
the additional records
additionals
,
Throwable
the resolution failure
cause
,
EventLoop
the EventLoop used to register the TTL timeout
loop
)

Cache the resolution failure for a given hostname.

public void
clear()

Clears all the resolved addresses cached by this resolver.

public boolean

Returns:

true if and only if there was an entry for the specified host name in the cache and it has been removed by this method
clear
(String hostname)

Clears the resolved addresses of the specified host name from the cache of this resolver.

public List<? extends DnsCacheEntry>

Returns:

the cached entries
get
(String
the hostname
hostname
,
DnsRecord[]
the additional records
additionals
)

Return the cached entries for the given hostname.

Method Detail

cacheback to summary
public DnsCacheEntry cache(String hostname, DnsRecord[] additionals, InetAddress address, long originalTtl, EventLoop loop)

Create a new DnsCacheEntry and cache a resolved address for a given hostname.

Parameters
hostname:String

the hostname

additionals:DnsRecord[]

the additional records

address:InetAddress

the resolved address

originalTtl:long

the TTL as returned by the DNS server

loop:EventLoop

the EventLoop used to register the TTL timeout

Returns:DnsCacheEntry

The DnsCacheEntry corresponding to this cache entry.

cacheback to summary
public DnsCacheEntry cache(String hostname, DnsRecord[] additionals, 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:String

the hostname

additionals:DnsRecord[]

the additional records

cause:Throwable

the resolution failure

loop:EventLoop

the EventLoop used to register the TTL timeout

Returns:DnsCacheEntry

The DnsCacheEntry corresponding to this cache entry, or null if this cache doesn't support caching failed responses.

clearback to summary
public void clear()

Clears all the resolved addresses cached by this resolver.

See Also
clear(String)
clearback to summary
public boolean clear(String hostname)

Clears the resolved addresses of the specified host name from the cache of this resolver.

Returns:boolean

true if and only if there was an entry for the specified host name in the cache and it has been removed by this method

getback to summary
public List<? extends DnsCacheEntry> get(String hostname, DnsRecord[] additionals)

Return the cached entries for the given hostname.

Parameters
hostname:String

the hostname

additionals:DnsRecord[]

the additional records

Returns:List<? extends DnsCacheEntry>

the cached entries