Package org.cyclos.impl.utils.cache
Interface CacheHandler
-
- All Known Subinterfaces:
CacheHandlerImplementor
- All Known Implementing Classes:
CacheHandlerImpl,GuavaCacheHandlerImpl
public interface CacheHandlerManages cache implementations
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidapply(TreeMap<CacheType<? extends Serializable,? extends Serializable>,CacheOperation> operations)Apply the given cache operations for eachCacheType.<K extends Serializable,V extends Serializable>
Cache<K,V>getCache(CacheType<K,V> type)Returns theCacheimplementation for the given type<K extends Serializable,V extends Serializable>
Cache<K,V>getCacheIfInitialized(CacheType<K,V> type)Returns theCacheimplementation for the given type if it has already been initialized, or null otherwisecom.google.common.cache.Cache<Object,Object>getLocalCache()The local cache is a general-purpose Guava cache that can be used to store data in a cluster will never be distributed<K extends Serializable,V extends Serializable>
voidscheduleClear(CacheType<K,V> type)Schedules a cache clear to be executed after the current transaction has been committed (important to prevent the cache from being reloaded by another thread before the current transaction is committed, populating the cache with a stale value)<K extends Serializable,V extends Serializable>
voidscheduleEvict(CacheType<K,V> type, Set<K> keys)Schedules the eviction of the given cache keys after the current transaction has been committed (important to prevent the cache from being reloaded by another thread before the current transaction is committed, populating the cache with a stale value)<K extends Serializable,V extends Serializable>
voidscheduleEvict(CacheType<K,V> type, K key)Schedules the eviction of an specific cache key after the current transaction has been committed (important to prevent the cache from being reloaded by another thread before the current transaction is committed, populating the cache with a stale value)<K extends Serializable,V extends Serializable>
voidschedulePartialEvict(CacheType<K,V> type, SerializablePredicate<K> predicate)Schedules the eviction of the keys matching the given predicate after the current transaction has been committed (important to prevent the cache from being reloaded by another thread before the current transaction is committed, populating the cache with a stale value)
-
-
-
Method Detail
-
apply
void apply(TreeMap<CacheType<? extends Serializable,? extends Serializable>,CacheOperation> operations)
Apply the given cache operations for eachCacheType.
-
getCache
<K extends Serializable,V extends Serializable> Cache<K,V> getCache(CacheType<K,V> type)
Returns theCacheimplementation for the given type
-
getCacheIfInitialized
<K extends Serializable,V extends Serializable> Cache<K,V> getCacheIfInitialized(CacheType<K,V> type)
Returns theCacheimplementation for the given type if it has already been initialized, or null otherwise
-
getLocalCache
com.google.common.cache.Cache<Object,Object> getLocalCache()
The local cache is a general-purpose Guava cache that can be used to store data in a cluster will never be distributed
-
scheduleClear
<K extends Serializable,V extends Serializable> void scheduleClear(CacheType<K,V> type)
Schedules a cache clear to be executed after the current transaction has been committed (important to prevent the cache from being reloaded by another thread before the current transaction is committed, populating the cache with a stale value)
-
scheduleEvict
<K extends Serializable,V extends Serializable> void scheduleEvict(CacheType<K,V> type, K key)
Schedules the eviction of an specific cache key after the current transaction has been committed (important to prevent the cache from being reloaded by another thread before the current transaction is committed, populating the cache with a stale value)
-
scheduleEvict
<K extends Serializable,V extends Serializable> void scheduleEvict(CacheType<K,V> type, Set<K> keys)
Schedules the eviction of the given cache keys after the current transaction has been committed (important to prevent the cache from being reloaded by another thread before the current transaction is committed, populating the cache with a stale value)
-
schedulePartialEvict
<K extends Serializable,V extends Serializable> void schedulePartialEvict(CacheType<K,V> type, SerializablePredicate<K> predicate)
Schedules the eviction of the keys matching the given predicate after the current transaction has been committed (important to prevent the cache from being reloaded by another thread before the current transaction is committed, populating the cache with a stale value)
-
-