@Authors(value="Nikolche Mihajlovski") @Since(value="5.3.0") public class ConcurrentCache<K,V> extends AbstractMapImpl<K,ConcurrentCacheAtom<K,V>> implements Cache<K,V>
defaultValue, entries| Modifier and Type | Method and Description |
|---|---|
void |
bypass()
Notifies the cache that it's being bypassed due to any reason (useful for stats).
|
int |
capacity() |
void |
clear()
Clears the cache.
|
static <K,V> ConcurrentCache<K,V> |
create(String name,
int capacity,
Mapper<K,V> loader,
long ttlInMs,
ScheduledThreadPoolExecutor scheduler,
boolean statistics,
boolean manageable) |
V |
get(K key)
Returns the cached value for the given key, recalculating/reloading it if expired.
|
V |
getIfExists(K key)
Retrieves the cached value for the given key if it exists, or
null otherwise. |
void |
invalidate(K key)
Invalidates the cached value for the given key.
|
String |
name() |
void |
set(K key,
V value)
Sets a new cached value for the given key.
|
int |
size() |
CacheStats |
stats()
Retrieves the cache statistics.
|
long |
ttlInMs() |
findEntry, findEntry, getDefaultValue, setDefaultValuepublic static <K,V> ConcurrentCache<K,V> create(String name, int capacity, Mapper<K,V> loader, long ttlInMs, ScheduledThreadPoolExecutor scheduler, boolean statistics, boolean manageable)
public V get(K key)
public V getIfExists(K key)
null otherwise.getIfExists in interface Cache<K,V>public void invalidate(K key)
invalidate in interface Cache<K,V>public long ttlInMs()
public CacheStats stats()
Cachepublic String name()
public int capacity()
public void bypass()
CacheCopyright © 2014–2018 Nikolche Mihajlovski and contributors. All rights reserved.