|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
K - V - public interface Cache<K,V>
A Cache is a container which allows to hold key value pairs. The makes it technically very similar to a Map so
it does actually implements the Map interface.
Nevertheless a Map is more general than a Cache. A Cache has more a focus on the lifecycle of a
stored element. So some Cache implementations will e.g. clear elements from its store, which are not requested for a
given amount of time.
Do to the possibly fast clearing of elements the keySet(), values() and entrySet() returned are
unmodifiable and represent only a snapshot of the Cache state when the function call was made. The returned
Collections are not updated when the Cache content changes.
Note: this Cache represents a lightweight contract which is intended to be easily implementable. If a more
feature rich cache contract is needed take a look at com.google.common.cache.Cache.
CacheUtils| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface java.util.Map |
|---|
Map.Entry<K,V> |
| Method Summary | |
|---|---|
Set<Map.Entry<K,V>> |
entrySet()
Returns an unmodifiable Set of all Map.Entrys within the Cache which only represents a
snapshot in moment |
V |
getOrCreate(K key,
Factory<V> factory)
Gets a cached value or creates a new one using the given Factory and puts the new value into the cache. |
Set<K> |
keySet()
Returns an unmodifiable Set of all keys within the Cache which only represents a snapshot in moment |
Collection<V> |
values()
Returns an unmodifiable Collection of all values within the Cache which only represents a snapshot in moment |
| Methods inherited from interface java.util.Map |
|---|
clear, containsKey, containsValue, equals, get, hashCode, isEmpty, put, putAll, remove, size |
| Method Detail |
|---|
Set<K> keySet()
Set of all keys within the Cache which only represents a snapshot in moment
keySet in interface Map<K,V>Collection<V> values()
Collection of all values within the Cache which only represents a snapshot in moment
values in interface Map<K,V>Set<Map.Entry<K,V>> entrySet()
Set of all Map.Entrys within the Cache which only represents a
snapshot in moment
entrySet in interface Map<K,V>
V getOrCreate(K key,
Factory<V> factory)
Factory and puts the new value into the cache.
key - factory -
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||