public abstract class CaffeineCache<E> extends Object
CaffeineDnsCache
.
Uses the Caffeine caching library as opposed to Netty's io.netty.resolver.dns.Cache implementation so that we can:
1) Limit the cache's size (and intelligently evict entries)
2) Expose cache statsConstructor and Description |
---|
CaffeineCache(long maxSize) |
Modifier and Type | Method and Description |
---|---|
void |
cache(String key,
E entry,
int ttl) |
void |
clear() |
void |
clear(String key) |
Collection<E> |
get(String key) |
protected abstract boolean |
shouldReplaceAll(E entry)
Returns
true if this entry should replace all other entries that are already cached for the hostname. |
long |
size() |
com.github.benmanes.caffeine.cache.stats.CacheStats |
stats() |
protected abstract boolean shouldReplaceAll(E entry)
true
if this entry should replace all other entries that are already cached for the hostname.public void clear()
public void clear(String key)
public Collection<E> get(String key)
public long size()
public com.github.benmanes.caffeine.cache.stats.CacheStats stats()
Copyright © 2021. All rights reserved.