Interface CacheBinding<K,V>

All Known Subinterfaces:
PersistentCacheBinding<K,V>

public interface CacheBinding<K,V>
Configure a cache declared within a CacheModule instance.
  • Method Details

    • maximumWeight

      @CanIgnoreReturnValue CacheBinding<K,V> maximumWeight(long weight)
      Set the total size of the cache.
    • expireAfterWrite

      @CanIgnoreReturnValue CacheBinding<K,V> expireAfterWrite(Duration duration)
      Set the time an element lives after last write before being expired.
    • expireFromMemoryAfterAccess

      @CanIgnoreReturnValue CacheBinding<K,V> expireFromMemoryAfterAccess(Duration duration)
      Set the time an element lives after last access before being expired.
    • refreshAfterWrite

      @CanIgnoreReturnValue CacheBinding<K,V> refreshAfterWrite(Duration duration)
      Set the time that an element will be refreshed after. Elements older than this but younger than expireAfterWrite(Duration) will still be returned, but on access a task is queued to refresh their value asynchronously.
    • loader

      @CanIgnoreReturnValue CacheBinding<K,V> loader(Class<? extends com.google.common.cache.CacheLoader<K,V>> clazz)
      Populate the cache with items from the CacheLoader.
    • weigher

      @CanIgnoreReturnValue CacheBinding<K,V> weigher(Class<? extends com.google.common.cache.Weigher<K,V>> clazz)
      Algorithm to weigh an object with a method other than the unit weight 1.
    • configKey

      @CanIgnoreReturnValue CacheBinding<K,V> configKey(String configKey)
      Set the config name to something other than the cache name.
      See Also: