Class Cache<E>

java.lang.Object
io.netty.resolver.dns.Cache<E>
Type Parameters:
E -

abstract class Cache<E> extends Object
Abstract cache that automatically removes entries for a hostname once the TTL for an entry is reached.
  • Field Details

  • Constructor Details

    • Cache

      Cache()
  • Method Details

    • clear

      final void clear()
      Remove everything from the cache.
    • clear

      final boolean clear(String hostname)
      Clear all entries (if anything exists) for the given hostname and return true if anything was removed.
    • get

      final List<? extends E> get(String hostname)
      Returns all caches entries for the given hostname.
    • cache

      final void cache(String hostname, E value, int ttl, EventLoop loop)
      Cache a value for the given hostname that will automatically expire once the TTL is reached.
    • size

      final int size()
      Return the number of hostnames for which we have cached something.
    • shouldReplaceAll

      protected abstract boolean shouldReplaceAll(E entry)
      Returns true if this entry should replace all other entries that are already cached for the hostname.
    • sortEntries

      protected void sortEntries(String hostname, List<E> entries)
      Sort the List for a hostname before caching these.
    • equals

      protected abstract boolean equals(E entry, E otherEntry)
      Returns true if both entries are equal.