Class CacheBuilder<K,​V>


  • public class CacheBuilder<K,​V>
    extends java.lang.Object
    • Method Detail

      • builder

        public static <K,​V> CacheBuilder<K,​V> builder()
      • setMaximumWeight

        public CacheBuilder<K,​V> setMaximumWeight​(long maximumWeight)
      • setExpireAfterAccess

        public CacheBuilder<K,​V> setExpireAfterAccess​(TimeValue expireAfterAccess)
        Sets the amount of time before an entry in the cache expires after it was last accessed.
        Parameters:
        expireAfterAccess - The amount of time before an entry expires after it was last accessed. Must not be null and must be greater than 0.
      • setExpireAfterWrite

        public CacheBuilder<K,​V> setExpireAfterWrite​(TimeValue expireAfterWrite)
        Sets the amount of time before an entry in the cache expires after it was written.
        Parameters:
        expireAfterWrite - The amount of time before an entry expires after it was written. Must not be null and must be greater than 0.
      • weigher

        public CacheBuilder<K,​V> weigher​(java.util.function.ToLongBiFunction<K,​V> weigher)
      • build

        public Cache<K,​V> build()