- 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 voidcache(String hostname, String cname, long originalTtl, EventLoop loop)Caches a cname entry that should be used for the given hostname.voidclear()Clears all cached nameservers.booleanclear(String hostname)Clears the cached nameservers for the specified hostname.Stringget(String hostname)Returns the cached cname for the given hostname.
-
-
-
Method Detail
-
get
public String get(String hostname)
Description copied from interface:DnsCnameCacheReturns the cached cname for the given hostname.- Specified by:
getin interfaceDnsCnameCache- Parameters:
hostname- the hostname- Returns:
- the cached entries or an
nullif none.
-
cache
public void cache(String hostname, String cname, long originalTtl, EventLoop loop)
Description copied from interface:DnsCnameCacheCaches a cname entry that should be used for the given hostname.- Specified by:
cachein interfaceDnsCnameCache- Parameters:
hostname- the hostnamecname- the cname mapping.originalTtl- the TTL as returned by the DNS serverloop- theEventLoopused to register the TTL timeout
-
clear
public void clear()
Description copied from interface:DnsCnameCacheClears all cached nameservers.- Specified by:
clearin interfaceDnsCnameCache- See Also:
DnsCnameCache.clear(String)
-
clear
public boolean clear(String hostname)
Description copied from interface:DnsCnameCacheClears the cached nameservers for the specified hostname.- Specified by:
clearin interfaceDnsCnameCache- Returns:
trueif and only if there was an entry for the specified host name in the cache and it has been removed by this method
-
-