@java.lang.SuppressWarnings("unused") public class MCache<K, V> extends java.lang.Object implements javax.cache.Cache
A simple implementation of the javax.cache.Cache interface. Basically a wrapper around a Map with stats and expiry.
Constructor and description |
---|
MCache
(java.lang.String name, javax.cache.CacheManager manager, javax.cache.configuration.Configuration<K, V> configuration) Supports a few configurations but both manager and configuration can be null. |
Type Params | Return Type | Name and description |
---|---|---|
|
public void |
clear() |
|
public int |
clearExpired() |
|
public void |
close() |
|
public boolean |
containsKey(K key) |
|
public void |
deregisterCacheEntryListener(javax.cache.configuration.CacheEntryListenerConfiguration<K, V> cacheEntryListenerConfiguration) |
|
public V |
get(K key) |
|
public V |
get(K key, javax.cache.expiry.ExpiryPolicy policy) |
|
public V |
get(K key, long expireBeforeTime) Get with expire if the entry's last updated time is before the expireBeforeTime. |
|
public javax.cache.expiry.Duration |
getAccessDuration() |
|
public java.util.Map<K, V> |
getAll(java.util.Set<? extends K> keys) |
|
public V |
getAndPut(K key, V value) |
|
public V |
getAndRemove(K key) |
|
public V |
getAndReplace(K key, V value) |
|
public javax.cache.CacheManager |
getCacheManager() |
<C extends Configuration<K, V>> |
public C |
getConfiguration(java.lang.Class<C> clazz) |
|
public javax.cache.expiry.Duration |
getCreationDuration() |
|
public MEntry<K, V> |
getEntry(K key, javax.cache.expiry.ExpiryPolicy policy) Get an entry, if it is in the cache and not expired, otherwise returns null. |
|
public java.util.ArrayList<Entry<K, V>> |
getEntryList() Gets all entries, checking for expiry and counts a get for each |
|
public MEntry<K, V> |
getEntryNoCheck(K key) Simple entry get, doesn't check if expired. |
|
public MStats |
getMStats() |
|
public int |
getMaxEntries() |
|
public java.lang.String |
getName() |
|
public javax.cache.management.CacheStatisticsMXBean |
getStats() |
|
public javax.cache.expiry.Duration |
getUpdateDuration() |
<T> |
public T |
invoke(K key, javax.cache.processor.EntryProcessor<K, V, T> entryProcessor, java.lang.Object arguments) |
<T> |
public java.util.Map<K, javax.cache.processor.EntryProcessorResult<T>> |
invokeAll(java.util.Set<? extends K> keys, javax.cache.processor.EntryProcessor<K, V, T> entryProcessor, java.lang.Object arguments) |
|
public boolean |
isClosed() |
|
public java.util.Iterator<Entry<K, V>> |
iterator() |
|
public void |
loadAll(java.util.Set<? extends K> keys, boolean replaceExistingValues, javax.cache.integration.CompletionListener completionListener) |
|
public void |
put(K key, V value) |
|
public void |
putAll(java.util.Map<? extends K, ? extends V> map) |
|
public boolean |
putIfAbsent(K key, V value) |
|
public void |
registerCacheEntryListener(javax.cache.configuration.CacheEntryListenerConfiguration<K, V> cacheEntryListenerConfiguration) |
|
public boolean |
remove(K key) |
|
public boolean |
remove(K key, V oldValue) |
|
public void |
removeAll(java.util.Set<? extends K> keys) |
|
public void |
removeAll() |
|
public boolean |
replace(K key, V oldValue, V newValue) |
|
public boolean |
replace(K key, V value) |
|
public void |
setMaxEntries(int elements) |
|
public int |
size() |
<T> |
public T |
unwrap(java.lang.Class<T> clazz) |
Methods inherited from class | Name |
---|---|
class java.lang.Object |
java.lang.Object#wait(long), java.lang.Object#wait(long, int), java.lang.Object#wait(), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll() |
Supports a few configurations but both manager and configuration can be null.
Get with expire if the entry's last updated time is before the expireBeforeTime. Useful when last updated time of a resource is known to see if the cached entry is out of date.
Get an entry, if it is in the cache and not expired, otherwise returns null. The policy can be null to use cache's policy.
Gets all entries, checking for expiry and counts a get for each
Simple entry get, doesn't check if expired.