Class CacheBuilder<K,​V>

java.lang.Object
org.elasticsearch.common.cache.CacheBuilder<K,​V>

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

    • builder

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

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

      public CacheBuilder<K,​V> setExpireAfterAccess​(org.elasticsearch.common.unit.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​(org.elasticsearch.common.unit.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)
    • removalListener

      public CacheBuilder<K,​V> removalListener​(RemovalListener<K,​V> removalListener)
    • build

      public Cache<K,​V> build()