Package org.restheart.cache
Class CacheFactory
- java.lang.Object
-
- org.restheart.cache.CacheFactory
-
public class CacheFactory extends Object
- Author:
- Andrea Di Cesare <andrea@softinstigate.com>
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <K,V>
Cache<K,V>createLocalCache(long size, Cache.EXPIRE_POLICY expirePolicy, long ttl)static <K,V>
Cache<K,V>createLocalCache(long size, Cache.EXPIRE_POLICY expirePolicy, long ttl, Consumer<Map.Entry<K,Optional<V>>> remover)static <K,V>
LoadingCache<K,V>createLocalLoadingCache(long size, Cache.EXPIRE_POLICY expirePolicy, long ttl, Function<K,V> loader)
-
-
-
Method Detail
-
createLocalLoadingCache
public static <K,V> LoadingCache<K,V> createLocalLoadingCache(long size, Cache.EXPIRE_POLICY expirePolicy, long ttl, Function<K,V> loader)
- Type Parameters:
K- the type of the cache keysV- the type of the cached values- Parameters:
size- the size of the cacheexpirePolicy- specifies how and when each entry should be automatically removed from the cachettl- Time To Live in millisecondsloader- the cache loader used to obtain new values- Returns:
- the cache
-
createLocalCache
public static <K,V> Cache<K,V> createLocalCache(long size, Cache.EXPIRE_POLICY expirePolicy, long ttl)
- Type Parameters:
K- the type of the cache keysV- the type of the cached values- Parameters:
size- the size of the cacheexpirePolicy- specifies how and when each entry should be automatically removed from the cachettl- Time To Live in milliseconds- Returns:
- the cache.
-
createLocalCache
public static <K,V> Cache<K,V> createLocalCache(long size, Cache.EXPIRE_POLICY expirePolicy, long ttl, Consumer<Map.Entry<K,Optional<V>>> remover)
- Type Parameters:
K- the type of the cache keys.V- the type of the cached values.- Parameters:
size- the size of the cache.expirePolicy- specifies how and when each entry should be automatically removed from the cache.ttl- Time To Live in milliseconds.remover- the cache remover to invoke each time a value is automatically removed from the cache according to the expire xpolicy- Returns:
- the cache.
-
-