Package com.ibm.fhir.cache.util
Class CacheSupport
- java.lang.Object
-
- com.ibm.fhir.cache.util.CacheSupport
-
public final class CacheSupport extends Object
A utility class for creating Caffeine cache instances
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <K,V>
com.github.benmanes.caffeine.cache.Cache<K,V>createCache(int maximumSize)
Create a cache with a size-based eviction policystatic <K,V>
com.github.benmanes.caffeine.cache.Cache<K,V>createCache(int maximumSize, boolean recordStats)
Create a cache with a size-based eviction policystatic <K,V>
com.github.benmanes.caffeine.cache.Cache<K,V>createCache(int maximumSize, Duration duration)
Create a cache with both size and time-based eviction policiesstatic <K,V>
com.github.benmanes.caffeine.cache.Cache<K,V>createCache(int maximumSize, Duration duration, boolean recordStats)
Create a cache with both size and time-based eviction policiesstatic <K,V>
com.github.benmanes.caffeine.cache.Cache<K,V>createCache(Duration duration)
Create a cache with a time-based eviction policystatic <K,V>
com.github.benmanes.caffeine.cache.Cache<K,V>createCache(Duration duration, boolean recordStats)
Create a cache with a time-based eviction policystatic <K,V>
Map<K,V>createCacheAsMap(int maximumSize)
Create a cache with a size-based eviction policy as a thread-safe mapstatic <K,V>
Map<K,V>createCacheAsMap(int maximumSize, Duration duration)
Create a cache with both size and time-based eviction policies as a thead-safe mapstatic <K,V>
Map<K,V>createCacheAsMap(Duration duration)
Create a cache with a time-based eviction policy as a thread-safe map
-
-
-
Method Detail
-
createCache
public static <K,V> com.github.benmanes.caffeine.cache.Cache<K,V> createCache(Duration duration)
Create a cache with a time-based eviction policy- Type Parameters:
K
- the key typeV
- the value type- Parameters:
duration
- the duration of entries after they are written to the cache- Returns:
- the cache instance
-
createCache
public static <K,V> com.github.benmanes.caffeine.cache.Cache<K,V> createCache(Duration duration, boolean recordStats)
Create a cache with a time-based eviction policy- Type Parameters:
K
- the key typeV
- the value type- Parameters:
duration
- the duration of entries after they are written to the cacherecordStats
- specifies whether stats should be recorded for the cache- Returns:
- the cache instance
-
createCache
public static <K,V> com.github.benmanes.caffeine.cache.Cache<K,V> createCache(int maximumSize)
Create a cache with a size-based eviction policy- Type Parameters:
K
- the key typeV
- the value type- Parameters:
maximumSize
- the maximum size of the cache before entries are evicted- Returns:
- the cache instance
-
createCache
public static <K,V> com.github.benmanes.caffeine.cache.Cache<K,V> createCache(int maximumSize, boolean recordStats)
Create a cache with a size-based eviction policy- Type Parameters:
K
- the key typeV
- the value type- Parameters:
maximumSize
- the maximum size of the cache before entries are evictedrecordStats
- specifies whether stats should be recorded for the cache- Returns:
- the cache instance
-
createCache
public static <K,V> com.github.benmanes.caffeine.cache.Cache<K,V> createCache(int maximumSize, Duration duration)
Create a cache with both size and time-based eviction policies- Type Parameters:
K
- the key typeV
- the value type- Parameters:
maximumSize
- the maximum size of the cache before entries are evictedduration
- the duration of entries after they are written to the cache- Returns:
- the cache instance
-
createCache
public static <K,V> com.github.benmanes.caffeine.cache.Cache<K,V> createCache(int maximumSize, Duration duration, boolean recordStats)
Create a cache with both size and time-based eviction policies- Type Parameters:
K
- the key typeV
- the value type- Parameters:
maximumSize
- the maximum size of the cache before entries are evictedduration
- the duration of entries after they are written to the cacherecordStats
- specifies whether stats should be recorded for the cache- Returns:
- the cache instance
-
createCacheAsMap
public static <K,V> Map<K,V> createCacheAsMap(Duration duration)
Create a cache with a time-based eviction policy as a thread-safe map- Type Parameters:
K
- the key typeV
- the value type- Parameters:
duration
- the duration of entries after they are written to the cache- Returns:
- a thread-safe map view of entries in the cache instance
-
createCacheAsMap
public static <K,V> Map<K,V> createCacheAsMap(int maximumSize)
Create a cache with a size-based eviction policy as a thread-safe map- Type Parameters:
K
- the key typeV
- the value type- Parameters:
maximumSize
- the maximum size of the cache before entries are evicted- Returns:
- a thread-safe map view of entries in the cache instance
-
createCacheAsMap
public static <K,V> Map<K,V> createCacheAsMap(int maximumSize, Duration duration)
Create a cache with both size and time-based eviction policies as a thead-safe map- Type Parameters:
K
- the key typeV
- the value type- Parameters:
maximumSize
- the maximum size of the cache before entries are evictedduration
- the duration of entries after they are written to the cache- Returns:
- a thread-safe map view of entries in the cache instance
-
-