Class CacheFactory

java.lang.Object
com.landawn.abacus.cache.CacheFactory

public final class CacheFactory extends Object
A factory for creating Cache objects.
Since:
0.8
Author:
Haiyang Li
  • Method Details

    • createLocalCache

      public static <K, V> LocalCache<K,V> createLocalCache(int capacity, long evictDelay)
      Creates a new Cache object.
      Type Parameters:
      K - the key type
      V - 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 type
      V - the value type
      Parameters:
      capacity -
      evictDelay -
      defaultLiveTime - default value is 3 hours
      defaultMaxIdleTime - 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

      public static <K, V> DistributedCache<K,V> createDistributedCache(DistributedCacheClient<V> dcc)
      Creates a new Cache object.
      Type Parameters:
      K - the key type
      V - 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 type
      V - 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 type
      V - the value type
      Parameters:
      dcc -
      keyPrefix -
      maxFailedNumForRetry -
      retryDelay -
      Returns:
    • createCache

      public static <K, V> Cache<K,V> createCache(String provider)
      Creates a new Cache object.
      Type Parameters:
      K - the key type
      V - the value type
      Parameters:
      provider -
      Returns: