K - Type of the cache-keyV - Type of the cache-value@ThreadSafe public class ChangingValueAndLevelMultiCache<K,V> extends ChangingValueCache<K,V>
ChangingValueCache, but with prioritization of the cache-entries. Cache-entries are given a priority (level) and non-overlapping
intervals of levels define different prioritizations. When a cache-value is modified the level and hence the prioritization of the cache-entry can change| Modifier and Type | Class and Description |
|---|---|
static interface |
ChangingValueAndLevelMultiCache.BiFunction<T,U,R> |
static class |
ChangingValueAndLevelMultiCache.Builder<K,V>
Builder for building
ChangingValueAndLevelMultiCache instances |
static class |
ChangingValueAndLevelMultiCache.Interval |
| Modifier and Type | Field and Description |
|---|---|
protected Map<ChangingValueAndLevelMultiCache.Interval,com.google.common.cache.Cache<K,V>> |
caches |
protected ChangingValueAndLevelMultiCache.BiFunction<K,V,Integer> |
levelCalculator |
protected Map<com.google.common.cache.Cache<K,V>,String> |
names |
alreadyWorkingOn, cache, defaultModifier, defaultNewCreator, newOrMovingCacheEntryInterner| Constructor and Description |
|---|
ChangingValueAndLevelMultiCache() |
| Modifier and Type | Method and Description |
|---|---|
static <K,V> ChangingValueAndLevelMultiCache.Builder<K,V> |
builder()
Get a builder for building a
ChangingValueAndLevelMultiCache instance |
protected com.google.common.cache.Cache<K,V> |
cacheForLevel(int level) |
protected Pair<com.google.common.cache.Cache<K,V>,V> |
createCacheAndValuePair(com.google.common.cache.Cache<K,V> cache,
V value) |
protected Collection<com.google.common.cache.Cache<K,V>> |
getAllCaches() |
Pair<com.google.common.cache.Cache<K,V>,V> |
getCacheAndValueIfPresent(K key)
Get a cache-value and the internal cache it currently lives in of a cache-entry with a provided key
|
protected V |
modifyImpl(K key,
com.google.common.base.Supplier<V> newCreator,
com.google.common.base.Function<V,V> modifier,
boolean createIfNotExists,
boolean supportRecursiveCalls) |
getAddIfNotPresent, getAddIfNotPresent, getIfPresent, modify, modify, modify, modify, modify, modifyAll, modifyAll, modifyAll, sizeprotected Map<ChangingValueAndLevelMultiCache.Interval,com.google.common.cache.Cache<K,V>> caches
protected ChangingValueAndLevelMultiCache.BiFunction<K,V,Integer> levelCalculator
public static <K,V> ChangingValueAndLevelMultiCache.Builder<K,V> builder()
ChangingValueAndLevelMultiCache instanceK - Type of the cache-key of the built cacheV - Type of the cache-value of the built cacheprotected V modifyImpl(K key, com.google.common.base.Supplier<V> newCreator, com.google.common.base.Function<V,V> modifier, boolean createIfNotExists, boolean supportRecursiveCalls)
modifyImpl in class ChangingValueCache<K,V>protected Collection<com.google.common.cache.Cache<K,V>> getAllCaches()
getAllCaches in class ChangingValueCache<K,V>public Pair<com.google.common.cache.Cache<K,V>,V> getCacheAndValueIfPresent(K key)
key - The key of the cache-entryprotected Pair<com.google.common.cache.Cache<K,V>,V> createCacheAndValuePair(com.google.common.cache.Cache<K,V> cache, V value)
Copyright © 2015 teletronics.ae. All rights reserved.