|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectbe.ehealth.technicalconnector.cache.impl.HashMapCache<K,V>
public class HashMapCache<K,V>
Implementation of Cache
based on a HashMap implementation.
Warning Not safe to use in a multi threaded environment.
Constructor Summary | |
---|---|
HashMapCache()
|
Method Summary | |
---|---|
void |
clear()
Clear the cache. |
boolean |
containsKey(K key)
Returns true, if there is a mapping for the specified key. |
V |
get(K key)
Returns a value associated by the given key, that contains a non expired value. |
String |
getName()
A configured or generated name of this cache instance. |
void |
put(K key,
V value)
Updates an existing cache entry for the specified key, so it associates the given value, or, insert a new cache entry for this key and value. |
void |
putAll(Map<K,V> map)
|
void |
remove(K key)
Removes the mapping for a key from the cache if it is present. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public HashMapCache()
Method Detail |
---|
public String getName()
Cache
getName
in interface Cache<K,V>
public V get(K key)
Cache
null
is returned.
get
in interface Cache<K,V>
key
- key with which the specified value is associated
null
if there was no mapping for the key.public boolean containsKey(K key)
Cache
containsKey
in interface Cache<K,V>
key
- key which association should be checked
true
, if this cache contains a mapping for the specified keypublic void put(K key, V value)
Cache
put
in interface Cache<K,V>
key
- key with which the specified value is associatedvalue
- value to be associated with the specified keypublic void remove(K key)
Cache
remove
in interface Cache<K,V>
key
- key which mapping is to be removed from the cache, not nullpublic void clear()
Cache
clear
in interface Cache<K,V>
public void putAll(Map<K,V> map)
putAll
in interface Cache<K,V>
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |