public abstract class ObjectCacheBase<K,V> extends CacheHitRateable
| Modifier and Type | Class and Description |
|---|---|
static interface |
ObjectCacheBase.CriticalSection |
| Modifier and Type | Field and Description |
|---|---|
static int |
DEFAULT_SIZE |
static int |
MIN_SIZE |
protected int |
size |
| Modifier | Constructor and Description |
|---|---|
protected |
ObjectCacheBase(int size) |
| Modifier and Type | Method and Description |
|---|---|
void |
adjustHitRate() |
abstract V |
cacheObject(K key,
V x) |
abstract void |
clear() |
boolean |
containsKey(K key) |
abstract int |
count() |
static java.lang.String |
formatHitRate(float hitRate)
Formats hit rate in percent with one decimal place.
|
V |
get(K key) |
abstract V |
getObject(K key) |
boolean |
isCached(K key) |
boolean |
isEmpty() |
abstract void |
lock() |
ObjectCacheBase.CriticalSection |
newCriticalSection() |
V |
put(K key,
V value) |
abstract V |
remove(K key) |
int |
size() |
abstract V |
tryKey(K key) |
V |
tryKeyLocked(K key) |
abstract void |
unlock() |
close, getAttempts, getCacheAdjuster, getHits, hitRate, incAttempts, incHits, setAttempts, setHitspublic static final int DEFAULT_SIZE
public static final int MIN_SIZE
protected final int size
public boolean isEmpty()
public int size()
public boolean containsKey(K key)
public boolean isCached(K key)
public abstract void clear()
public abstract void lock()
public abstract void unlock()
public abstract int count()
public static java.lang.String formatHitRate(float hitRate)
hitRate - hit rate value in the interval [0..1]public void adjustHitRate()
adjustHitRate in class CacheHitRateablepublic ObjectCacheBase.CriticalSection newCriticalSection()