Class Caches
-
Method Summary
Modifier and TypeMethodDescriptionstatic <K,
V> Map<K, V> getClusteredCache
(String name) Constructs a clustered Cache.static <K,
V> Map<K, V> getClusteredCache
(String name, int capacity, long lifespan) Constructs a clustered Cache.
-
Method Details
-
getClusteredCache
Constructs a clustered Cache.The operations clear() and remove(K) are propagated within the cluster. The operation put(K,V) is propagated within the cluster if the result of put (the previous value) is not null. Please note that a local put operation is propagated exactly like a remove operation (the caches on the remote node will remove the entry).
In a non-clustered environment, there is virtually no overhead compared to a local map.
- Type Parameters:
K
- the type of the keysV
- the type of the values- Parameters:
name
- the name of the cache- Returns:
- a clustered cache. throws an ApplicationException, when a cache with this name already exists
-
getClusteredCache
Constructs a clustered Cache.The operations clear() and remove(K) are propagated within the cluster. The operation put(K,V) is propagated within the cluster if the result of put (the previous value) is not null. Please note that a local put operation is propagated exactly like a remove operation (the caches on the remote node will remove the entry).
In a non-clustered environment, there is virtually no overhead compared to a local map.
- Type Parameters:
K
- the type of the keysV
- the type of the values- Parameters:
name
- the name of the cachecapacity
- the maximum count of elements in the cache. if the value is less than 1, the cache has unlimited capacitylifespan
- the maximum amount of milliseconds an cache entry is 'valid'. if the value is less than 1, elements have no lifespan restriction- Returns:
- a clustered cache. throws an ApplicationException, when a cache with this name already exists
-