- java.lang.Object
-
- io.netty5.resolver.dns.DefaultDnsCnameCache
-
- All Implemented Interfaces:
DnsCnameCache
public final class DefaultDnsCnameCache extends Object implements DnsCnameCache
Default implementation of aDnsCnameCache
.
-
-
Constructor Summary
Constructors Constructor Description DefaultDnsCnameCache()
Create a cache that respects the TTL returned by the DNS server.DefaultDnsCnameCache(int minTtl, int maxTtl)
Create a cache.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
cache(String hostname, String cname, long originalTtl, EventLoop loop)
Caches a cname entry that should be used for the given hostname.void
clear()
Clears all cached nameservers.boolean
clear(String hostname)
Clears the cached nameservers for the specified hostname.String
get(String hostname)
Returns the cached cname for the given hostname.
-
-
-
Method Detail
-
get
public String get(String hostname)
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
public void cache(String hostname, String cname, long originalTtl, EventLoop loop)
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:
DnsCnameCache.clear(String)
-
clear
public boolean clear(String hostname)
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
-
-