Interface JCacheUtil
- All Known Implementing Classes:
DefaultEhCacheUtil
,DefaultJCacheUtil
public interface JCacheUtil
Generic utility to allow one access to the JCache
CacheManager
. This also allows for the encapsulation of implementation-specific cache configurations that may
not be supported by the generic JCache (JSR 107) APIs.- Author:
- Kelly Tisdell
-
Method Summary
Modifier and TypeMethodDescriptioncreateCache
(String cacheName, int ttlSeconds, int maxElementsInMemory) Returns a new Cache with the appropriate cache name, TTL, and maxElements.<K,
V> javax.cache.Cache<K, V> createCache
(String cacheName, int ttlSeconds, int maxElementsInMemory, Class<K> key, Class<V> value) Returns a new Cache with the appropriate cache name, TTL, and maxElements.<K,
V> javax.cache.Cache<K, V> Returns the cache associated with the name or null if no cache exists.javax.cache.CacheManager
-
Method Details
-
getCacheManager
javax.cache.CacheManager getCacheManager() -
createCache
javax.cache.Cache<Object,Object> createCache(String cacheName, int ttlSeconds, int maxElementsInMemory) Returns a new Cache with the appropriate cache name, TTL, and maxElements. If the cache exists, an exception will be thrown.The ttl and maxElementsInMemory settings may be implementation specific and so implementors may choose to ignore these arguments.
If ttlSeconds is less than 1 then the cache will not expire.
- Parameters:
cacheName
-ttlSeconds
-maxElementsInMemory
-- Returns:
-
createCache
<K,V> javax.cache.Cache<K,V> createCache(String cacheName, int ttlSeconds, int maxElementsInMemory, Class<K> key, Class<V> value) Returns a new Cache with the appropriate cache name, TTL, and maxElements. If the cache exists, an exception will be thrown.The ttl and maxElementsInMemory settings may be implementation specific and so implementors may choose to ignore these arguments.
If ttlSeconds is less than 0 then the cache will not expire.
- Parameters:
cacheName
-ttlSeconds
-maxElementsInMemory
-key
-value
-- Returns:
-
getCache
Returns the cache associated with the name or null if no cache exists.- Parameters:
cacheName
-- Returns:
-