public class Cache<K,V> extends Object
Modifier and Type | Class and Description |
---|---|
static interface |
Cache.ChangeListener |
static class |
Cache.Value<V> |
Constructor and Description |
---|
Cache() |
Modifier and Type | Method and Description |
---|---|
void |
addChangeListener(Cache.ChangeListener l) |
void |
disableReaping() |
String |
dump() |
void |
enableReaping(long interval)
Runs the reaper every interval ms, evicts expired items
|
Set<Map.Entry<K,Cache.Value<V>>> |
entrySet() |
V |
get(K key) |
Cache.Value<V> |
getEntry(K key) |
ConcurrentMap<K,Cache.Value<V>> |
getInternalMap()
This method should not be used to add or remove elements ! It was just added because ReplCacheDemo
requires it for its data model
|
int |
getMaxNumberOfEntries() |
int |
getSize() |
boolean |
isReapingEnabled() |
V |
put(K key,
V val,
long caching_time) |
V |
remove(K key) |
void |
removeChangeListener(Cache.ChangeListener l) |
void |
setMaxNumberOfEntries(int max_num_entries) |
void |
start() |
void |
stop() |
String |
toString() |
public int getMaxNumberOfEntries()
public void setMaxNumberOfEntries(int max_num_entries)
public void addChangeListener(Cache.ChangeListener l)
public void removeChangeListener(Cache.ChangeListener l)
public int getSize()
public boolean isReapingEnabled()
public void enableReaping(long interval)
public void disableReaping()
public void start()
public void stop()
public V put(K key, V val, long caching_time)
key
- val
- caching_time
- Number of milliseconds to keep an entry in the cache. -1 means don't cache (if reaping
is enabled, we'll evict an entry with -1 caching time), 0 means never evict. In the latter case, we can still
evict an entry with 0 caching time: when we have a bounded cache, we evict in order of insertion no matter
what the caching time is.public ConcurrentMap<K,Cache.Value<V>> getInternalMap()
public Cache.Value<V> getEntry(K key)
public Set<Map.Entry<K,Cache.Value<V>>> entrySet()
public String dump()
Copyright © 2012 JBoss by Red Hat. All Rights Reserved.