Class CaffeineCache<E>


  • public abstract class CaffeineCache<E>
    extends java.lang.Object
    Underlying cache used to back the 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 stats
    Author:
    jwhite
    • Constructor Summary

      Constructors 
      Constructor Description
      CaffeineCache​(long maxSize)  
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      void cache​(java.lang.String key, E entry, int ttl)  
      void clear()  
      void clear​(java.lang.String key)  
      java.util.Collection<E> get​(java.lang.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()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • CaffeineCache

        public CaffeineCache​(long maxSize)
    • Method Detail

      • shouldReplaceAll

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

        public void clear()
      • clear

        public void clear​(java.lang.String key)
      • get

        public java.util.Collection<E> get​(java.lang.String key)
      • cache

        public void cache​(java.lang.String key,
                          E entry,
                          int ttl)
      • size

        public long size()
      • stats

        public com.github.benmanes.caffeine.cache.stats.CacheStats stats()