Class DefaultDnsCnameCache

    • Constructor Detail

      • 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 Detail

      • get

        public String get​(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​(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 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 boolean clear​(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