Class DefaultAuthoritativeDnsServerCache

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void cache​(java.lang.String hostname, java.net.InetSocketAddress address, long originalTtl, EventLoop loop)
      Caches a nameserver that should be used to resolve the given hostname.
      void clear()
      Clears all cached nameservers.
      boolean clear​(java.lang.String hostname)
      Clears the cached nameservers for the specified hostname.
      DnsServerAddressStream get​(java.lang.String hostname)
      Returns the cached nameservers that should be used to resolve the given hostname.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • DefaultAuthoritativeDnsServerCache

        public DefaultAuthoritativeDnsServerCache()
        Create a cache that respects the TTL returned by the DNS server.
      • DefaultAuthoritativeDnsServerCache

        public DefaultAuthoritativeDnsServerCache​(int minTtl,
                                                  int maxTtl,
                                                  java.util.Comparator<java.net.InetSocketAddress> comparator)
        Create a cache.
        Parameters:
        minTtl - the minimum TTL
        maxTtl - the maximum TTL
        comparator - the Comparator to order the InetSocketAddress for a hostname or null if insertion order should be used.
    • Method Detail

      • get

        public DnsServerAddressStream get​(java.lang.String hostname)
        Description copied from interface: AuthoritativeDnsServerCache
        Returns the cached nameservers that should be used to resolve the given hostname. The returned DnsServerAddressStream may contain unresolved InetSocketAddresses that will be resolved when needed while resolving other domain names.
        Specified by:
        get in interface AuthoritativeDnsServerCache
        Parameters:
        hostname - the hostname
        Returns:
        the cached entries or an null if none.
      • cache

        public void cache​(java.lang.String hostname,
                          java.net.InetSocketAddress address,
                          long originalTtl,
                          EventLoop loop)
        Description copied from interface: AuthoritativeDnsServerCache
        Caches a nameserver that should be used to resolve the given hostname.
        Specified by:
        cache in interface AuthoritativeDnsServerCache
        Parameters:
        hostname - the hostname
        address - the nameserver address (which may be unresolved).
        originalTtl - the TTL as returned by the DNS server
        loop - the EventLoop used to register the TTL timeout
      • clear

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

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object