Package com.landawn.abacus.cache
Class CacheFactory
java.lang.Object
com.landawn.abacus.cache.CacheFactory
A factory for creating Cache objects.
- Since:
- 0.8
- Author:
- Haiyang Li
-
Method Summary
Modifier and TypeMethodDescriptionstatic <K,V> Cache<K, V> createCache(String provider) Creates a new Cache object.static <K,V> DistributedCache<K, V> Creates a new Cache object.static <K,V> DistributedCache<K, V> createDistributedCache(DistributedCacheClient<V> dcc, String keyPrefix) Creates a new Cache object.static <K,V> DistributedCache<K, V> createDistributedCache(DistributedCacheClient<V> dcc, String keyPrefix, int maxFailedNumForRetry, long retryDelay) Creates a new Cache object.static <K,V> LocalCache<K, V> createLocalCache(int capacity, long evictDelay) Creates a new Cache object.static <K,V> LocalCache<K, V> createLocalCache(int capacity, long evictDelay, long defaultLiveTime, long defaultMaxIdleTime) Creates a new Cache object.static <K,V> LocalCache<K, V> createLocalCache(long defaultLiveTime, long defaultMaxIdleTime, com.landawn.abacus.pool.KeyedObjectPool<K, com.landawn.abacus.pool.PoolableWrapper<V>> pool)
-
Method Details
-
createLocalCache
Creates a new Cache object.- Type Parameters:
K- the key typeV- the value type- Parameters:
capacity-evictDelay-- Returns:
-
createLocalCache
public static <K,V> LocalCache<K,V> createLocalCache(int capacity, long evictDelay, long defaultLiveTime, long defaultMaxIdleTime) Creates a new Cache object.- Type Parameters:
K- the key typeV- the value type- Parameters:
capacity-evictDelay-defaultLiveTime- default value is 3 hoursdefaultMaxIdleTime- default value is 30 minutes- Returns:
-
createLocalCache
public static <K,V> LocalCache<K,V> createLocalCache(long defaultLiveTime, long defaultMaxIdleTime, com.landawn.abacus.pool.KeyedObjectPool<K, com.landawn.abacus.pool.PoolableWrapper<V>> pool) - Type Parameters:
K-V-- Parameters:
defaultLiveTime-defaultMaxIdleTime-pool-- Returns:
-
createDistributedCache
Creates a new Cache object.- Type Parameters:
K- the key typeV- the value type- Parameters:
dcc-- Returns:
-
createDistributedCache
public static <K,V> DistributedCache<K,V> createDistributedCache(DistributedCacheClient<V> dcc, String keyPrefix) Creates a new Cache object.- Type Parameters:
K- the key typeV- the value type- Parameters:
dcc-keyPrefix-- Returns:
-
createDistributedCache
public static <K,V> DistributedCache<K,V> createDistributedCache(DistributedCacheClient<V> dcc, String keyPrefix, int maxFailedNumForRetry, long retryDelay) Creates a new Cache object.- Type Parameters:
K- the key typeV- the value type- Parameters:
dcc-keyPrefix-maxFailedNumForRetry-retryDelay-- Returns:
-
createCache
Creates a new Cache object.- Type Parameters:
K- the key typeV- the value type- Parameters:
provider-- Returns:
-