Package io.netty.resolver.dns
Class Cache<E>
java.lang.Object
io.netty.resolver.dns.Cache<E>
- Type Parameters:
E
-
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 ScheduledFuture
<?> private static final AtomicReferenceFieldUpdater
<Cache.Entries, ScheduledFuture> (package private) static final int
private final ConcurrentMap
<String, Cache<E>.Entries> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) final void
Cache a value for the given hostname that will automatically expire once the TTL is reached.(package private) final void
clear()
Remove everything from the cache.(package private) final boolean
Clear all entries (if anything exists) for the given hostname and returntrue
if anything was removed.protected abstract boolean
Returnstrue
if both entries are equal.Returns all caches entries for the given hostname.protected abstract boolean
shouldReplaceAll
(E entry) Returnstrue
if this entry should replace all other entries that are already cached for the hostname.(package private) final int
size()
Return the number of hostnames for which we have cached something.protected void
sortEntries
(String hostname, List<E> entries) Sort theList
for ahostname
before caching these.
-
Field Details
-
FUTURE_UPDATER
-
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
Clear all entries (if anything exists) for the given hostname and returntrue
if anything was removed. -
get
Returns all caches entries for the given hostname. -
cache
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
Returnstrue
if this entry should replace all other entries that are already cached for the hostname. -
sortEntries
Sort theList
for ahostname
before caching these. -
equals
Returnstrue
if both entries are equal.
-