Package com.google.gerrit.server.cache
Interface CacheBinding<K,V>
- All Known Subinterfaces:
PersistentCacheBinding<K,
V>
public interface CacheBinding<K,V>
Configure a cache declared within a
CacheModule
instance.-
Method Summary
Modifier and TypeMethodDescriptionSet the config name to something other than the cache name.expireAfterWrite
(Duration duration) Set the time an element lives after last write before being expired.expireFromMemoryAfterAccess
(Duration duration) Set the time an element lives after last access before being expired.Populate the cache with items from the CacheLoader.maximumWeight
(long weight) Set the total size of the cache.refreshAfterWrite
(Duration duration) Set the time that an element will be refreshed after.Algorithm to weigh an object with a method other than the unit weight 1.
-
Method Details
-
maximumWeight
Set the total size of the cache. -
expireAfterWrite
Set the time an element lives after last write before being expired. -
expireFromMemoryAfterAccess
Set the time an element lives after last access before being expired. -
refreshAfterWrite
Set the time that an element will be refreshed after. Elements older than this but younger thanexpireAfterWrite(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
Set the config name to something other than the cache name.- See Also:
-