Package io.netty.resolver.dns
Class DefaultDnsCnameCache
java.lang.Object
io.netty.resolver.dns.DefaultDnsCnameCache
- All Implemented Interfaces:
DnsCnameCache
Default implementation of a
DnsCnameCache
.-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionCreate a cache that respects the TTL returned by the DNS server.DefaultDnsCnameCache
(int minTtl, int maxTtl) Create a cache. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Caches a cname entry that should be used for the given hostname.void
clear()
Clears all cached nameservers.boolean
Clears the cached nameservers for the specified hostname.Returns the cached cname for the given hostname.(package private) int
maxTtl()
(package private) int
minTtl()
-
Field Details
-
minTtl
private final int minTtl -
maxTtl
private final int maxTtl -
cache
-
-
Constructor Details
-
DefaultDnsCnameCache
public DefaultDnsCnameCache()Create a cache that respects the TTL returned by the DNS server. -
DefaultDnsCnameCache
public DefaultDnsCnameCache(int minTtl, int maxTtl) Create a cache.- Parameters:
minTtl
- the minimum TTLmaxTtl
- the maximum TTL
-
-
Method Details
-
get
Description copied from interface:DnsCnameCache
Returns the cached cname for the given hostname.- Specified by:
get
in interfaceDnsCnameCache
- Parameters:
hostname
- the hostname- Returns:
- the cached entries or an
null
if none.
-
cache
Description copied from interface:DnsCnameCache
Caches a cname entry that should be used for the given hostname.- Specified by:
cache
in interfaceDnsCnameCache
- Parameters:
hostname
- the hostnamecname
- the cname mapping.originalTtl
- the TTL as returned by the DNS serverloop
- theEventLoop
used to register the TTL timeout
-
clear
public void clear()Description copied from interface:DnsCnameCache
Clears all cached nameservers.- Specified by:
clear
in interfaceDnsCnameCache
- See Also:
-
clear
Description copied from interface:DnsCnameCache
Clears the cached nameservers for the specified hostname.- Specified by:
clear
in interfaceDnsCnameCache
- 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
-
minTtl
int minTtl() -
maxTtl
int maxTtl()
-