public class Cache<K,V>
extends java.lang.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() |
java.lang.String |
dump() |
void |
enableReaping(long interval)
Runs the reaper every interval ms, evicts expired items
|
java.util.Set<java.util.Map.Entry<K,Cache.Value<V>>> |
entrySet() |
V |
get(K key) |
Cache.Value<V> |
getEntry(K key) |
java.util.concurrent.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() |
java.lang.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 java.util.concurrent.ConcurrentMap<K,Cache.Value<V>> getInternalMap()
public Cache.Value<V> getEntry(K key)
public java.util.Set<java.util.Map.Entry<K,Cache.Value<V>>> entrySet()
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String dump()
Copyright © 1998-2020 Red Hat. All Rights Reserved.