Class DefaultDnsCnameCache

java.lang.Object
io.netty.resolver.dns.DefaultDnsCnameCache
All Implemented Interfaces:
DnsCnameCache

public final class DefaultDnsCnameCache extends java.lang.Object implements DnsCnameCache
Default implementation of a DnsCnameCache.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private final Cache<java.lang.String>
     
    private final int
     
    private final int
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    Create a cache that respects the TTL returned by the DNS server.
    DefaultDnsCnameCache(int minTtl, int maxTtl)
    Create a cache.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    cache(java.lang.String hostname, java.lang.String cname, long originalTtl, EventLoop loop)
    Caches a cname entry that should be used for the given hostname.
    void
    Clears all cached nameservers.
    boolean
    clear(java.lang.String hostname)
    Clears the cached nameservers for the specified hostname.
    java.lang.String
    get(java.lang.String hostname)
    Returns the cached cname for the given hostname.
    (package private) int
     
    (package private) int
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • minTtl

      private final int minTtl
    • maxTtl

      private final int maxTtl
    • cache

      private final Cache<java.lang.String> 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 TTL
      maxTtl - the maximum TTL
  • Method Details

    • get

      public java.lang.String get(java.lang.String hostname)
      Description copied from interface: DnsCnameCache
      Returns the cached cname for the given hostname.
      Specified by:
      get in interface DnsCnameCache
      Parameters:
      hostname - the hostname
      Returns:
      the cached entries or an null if none.
    • cache

      public void cache(java.lang.String hostname, java.lang.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 interface DnsCnameCache
      Parameters:
      hostname - the hostname
      cname - the cname mapping.
      originalTtl - the TTL as returned by the DNS server
      loop - the EventLoop used to register the TTL timeout
    • clear

      public void clear()
      Description copied from interface: DnsCnameCache
      Clears all cached nameservers.
      Specified by:
      clear in interface DnsCnameCache
      See Also:
    • clear

      public boolean clear(java.lang.String hostname)
      Description copied from interface: DnsCnameCache
      Clears the cached nameservers for the specified hostname.
      Specified by:
      clear in interface DnsCnameCache
      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()