Class Cache<E>
java.lang.Object
io.netty.resolver.dns.Cache<E>
- Type Parameters:
E-
abstract class Cache<E>
extends java.lang.Object
Abstract cache that automatically removes entries for a hostname once the TTL for an entry is reached.
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final java.util.concurrent.ScheduledFuture<?> private static final java.util.concurrent.atomic.AtomicReferenceFieldUpdater<Cache.Entries, java.util.concurrent.ScheduledFuture> (package private) static final int -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) final voidCache a value for the given hostname that will automatically expire once the TTL is reached.(package private) final voidclear()Remove everything from the cache.(package private) final booleanclear(java.lang.String hostname) Clear all entries (if anything exists) for the given hostname and returntrueif anything was removed.protected abstract booleanReturnstrueif both entries are equal.(package private) final java.util.List<? extends E> get(java.lang.String hostname) Returns all caches entries for the given hostname.protected abstract booleanshouldReplaceAll(E entry) Returnstrueif this entry should replace all other entries that are already cached for the hostname.(package private) final intsize()Return the number of hostnames for which we have cached something.protected voidsortEntries(java.lang.String hostname, java.util.List<E> entries) Sort theListfor ahostnamebefore caching these.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Field Details
-
FUTURE_UPDATER
private static final java.util.concurrent.atomic.AtomicReferenceFieldUpdater<Cache.Entries, java.util.concurrent.ScheduledFuture> FUTURE_UPDATER -
CANCELLED
private static final java.util.concurrent.ScheduledFuture<?> CANCELLED -
MAX_SUPPORTED_TTL_SECS
static final int MAX_SUPPORTED_TTL_SECS -
resolveCache
-
-
Constructor Details
-
Cache
Cache()
-
-
Method Details
-
clear
final void clear()Remove everything from the cache. -
clear
final boolean clear(java.lang.String hostname) Clear all entries (if anything exists) for the given hostname and returntrueif anything was removed. -
get
Returns all caches entries for the given hostname. -
cache
-
size
final int size()Return the number of hostnames for which we have cached something. -
shouldReplaceAll
Returnstrueif this entry should replace all other entries that are already cached for the hostname. -
sortEntries
Sort theListfor ahostnamebefore caching these. -
equals
-