@Authors(value="Nikolche Mihajlovski") @Since(value="5.3.0") public class ConcurrentCache<K,V> extends AbstractMapImpl<K,ConcurrentCacheAtom<V>> implements Cache<K,V>
defaultValue, entries| Constructor and Description |
|---|
ConcurrentCache(String name,
int buckets,
int bucketSize,
Mapper<K,V> loader,
long ttlInMs) |
| 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() |
static <K,V> ConcurrentCache<K,V> |
create(String name,
int capacity,
Mapper<K,V> loader,
long ttlInMs) |
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 |
putAtom(K key,
SimpleList<MapEntry<K,ConcurrentCacheAtom<V>>> bucket,
ConcurrentCacheAtom<V> atom) |
void |
set(K key,
V value)
Sets a new cached value for the given key.
|
int |
size() |
CacheStats |
stats() |
long |
ttlInMs() |
clear, findEntry, findEntry, getDefaultValue, setDefaultValuepublic static <K,V> ConcurrentCache<K,V> create(String name, int capacity, Mapper<K,V> loader, long ttlInMs)
public V get(K key)
public void putAtom(K key, SimpleList<MapEntry<K,ConcurrentCacheAtom<V>>> bucket, ConcurrentCacheAtom<V> atom)
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()
public String name()
public int size()
public int capacity()
Copyright © 2014–2017 Nikolche Mihajlovski and contributors. All rights reserved.