|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.teiid.cache.DefaultCache<K,V>
public class DefaultCache<K,V>
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface org.teiid.cache.Cache |
---|
Cache.Type |
Field Summary | |
---|---|
protected java.util.Map<java.lang.String,Cache> |
children
|
static int |
DEFAULT_MAX_AGE
|
static int |
DEFAULT_MAX_SIZE_TOTAL
|
protected java.util.LinkedHashSet<org.teiid.cache.DefaultCache.ExpirationEntry<K,V>> |
expirationQueue
|
protected LRUCache<K,org.teiid.cache.DefaultCache.ExpirationEntry<K,V>> |
map
|
protected java.lang.String |
name
|
protected long |
ttl
|
Constructor Summary | |
---|---|
DefaultCache(java.lang.String name)
|
|
DefaultCache(java.lang.String name,
int maxEntries,
long ttl)
|
Method Summary | |
---|---|
Cache |
addChild(java.lang.String name)
|
void |
addListener(CacheListener listener)
|
void |
clear()
Removes all the keys and their values from the Cache |
V |
get(K key)
Retrieves the value for the given Key |
Cache |
getChild(java.lang.String name)
|
java.util.Collection<Cache> |
getChildren()
|
static long |
getExpirationTime(long defaultTtl,
java.lang.Long ttl)
|
java.lang.String |
getName()
Name of the cache node |
java.util.Set<K> |
keySet()
|
V |
put(K key,
V value)
|
V |
put(K key,
V value,
java.lang.Long timeToLive)
Associates the specified value with the specified key this cache. |
V |
remove(K key)
Removes the value for this key from a Cache. |
boolean |
removeChild(java.lang.String name)
|
int |
size()
Size of the cache |
java.util.Collection<V> |
values()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int DEFAULT_MAX_SIZE_TOTAL
public static final int DEFAULT_MAX_AGE
protected LRUCache<K,org.teiid.cache.DefaultCache.ExpirationEntry<K,V>> map
protected java.util.Map<java.lang.String,Cache> children
protected java.lang.String name
protected long ttl
protected java.util.LinkedHashSet<org.teiid.cache.DefaultCache.ExpirationEntry<K,V>> expirationQueue
Constructor Detail |
---|
public DefaultCache(java.lang.String name)
public DefaultCache(java.lang.String name, int maxEntries, long ttl)
Method Detail |
---|
public void addListener(CacheListener listener)
public void clear()
Cache
clear
in interface Cache<K,V>
public V get(K key)
Cache
get
in interface Cache<K,V>
key
- key under which value is to be retrieved.
public java.util.Set<K> keySet()
public V put(K key, V value)
public static long getExpirationTime(long defaultTtl, java.lang.Long ttl)
public V put(K key, V value, java.lang.Long timeToLive)
Cache
put
in interface Cache<K,V>
key
- key with which the specified value is to be associated.value
- value to be associated with the specified key.timeToLive
- the time for this entry to live
null
if there was no mapping for key.
A null
return can also indicate that the key previously associated null
with the specified key,
if the implementation supports null values.public V remove(K key)
Cache
null
if the Key contained no mapping.
remove
in interface Cache<K,V>
key
- key whose mapping is to be removed
public int size()
Cache
size
in interface Cache<K,V>
public java.util.Collection<V> values()
public Cache addChild(java.lang.String name)
public Cache getChild(java.lang.String name)
public java.util.Collection<Cache> getChildren()
public boolean removeChild(java.lang.String name)
public java.lang.String getName()
Cache
getName
in interface Cache<K,V>
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |