Package com.linecorp.armeria.client
Interface DnsCache
A cache for DNS responses.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addListener
(DnsCacheListener listener) Adds a listener to thisDnsCache
.static DnsCacheBuilder
builder()
Returns a newDnsCacheBuilder
.default void
cache
(DnsQuestion question, DnsRecord... records) Caches a successful resolution.void
cache
(DnsQuestion question, Iterable<? extends DnsRecord> records) Caches a successful resolution.void
cache
(DnsQuestion question, UnknownHostException cause) Caches a failed resolution.get
(DnsQuestion question) Returns theDnsRecord
s associated with theDnsQuestion
in this cache.static DnsCache
Returns a newly-createdDnsCache
using the specifiedcacheSpec
.static DnsCache
Returns the default DNS cache.void
remove
(DnsQuestion question) Discards any cached value for the hostname.void
Discards all entries in this cache.
-
Method Details
-
ofDefault
Returns the default DNS cache. -
of
Returns a newly-createdDnsCache
using the specifiedcacheSpec
. -
builder
Returns a newDnsCacheBuilder
. -
cache
Caches a successful resolution.- Parameters:
question
- the DNS question.records
- the DNS records associated to the givenDnsQuestion
.
-
cache
Caches a successful resolution.- Parameters:
question
- the DNS question.records
- the DNS records associated to the givenDnsQuestion
.
-
cache
Caches a failed resolution.- Parameters:
question
- the DNS question.cause
- the resolution failure.
-
get
Returns theDnsRecord
s associated with theDnsQuestion
in this cache.null
if this cache contains no resolution for theDnsQuestion
.- Throws:
UnknownHostException
- if theDnsQuestion
previously failed with theUnknownHostException
and its negative TTL is valid.
-
remove
Discards any cached value for the hostname. -
removeAll
void removeAll()Discards all entries in this cache. -
addListener
Adds a listener to thisDnsCache
. TheDnsCacheListener
is notified whenever an event occurs.
-