|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
K
- type of the stored keysV
- type of the stored valuespublic interface Cache<K,V>
Interface representing a cache that is able to store key->value mappings. Provides methods for manipulating the cache and retrieving statistical information.
Method Summary | |
---|---|
int |
capacity()
Returns the maximum number of key->value mappings for this cache. |
void |
clear()
Remove all key->value mappings from the cache and cleans auxiliary data structures (such as history queues). |
boolean |
containsKey(K key)
Checks whether the specified key is cached. |
void |
evict()
Removes the next key from the cache according to the current cache replacement policy. |
V |
get(K key)
Gets the value associated with the specified key from the cache if a mapping exists, or the value returned by the resolver. |
Resolver<K,V> |
getResolver()
Gets the current resolver associated with this cache. |
float |
hitRatio()
Returns the hits/requests ratio in percents. |
long |
hits()
Returns the number of all hits. |
java.util.Set<K> |
keySet()
Gets all keys contained in the cache. |
long |
misses()
Returns the number of all misses. |
K |
nextEvicted()
Gets the next key that would be removed from the cache according to the current cache replacement policy. |
V |
put(K key,
V value)
Adds a new key->value mapping to the cache. |
V |
remove(K key)
Removes the specified key and its value from the cache. |
long |
requests()
Returns the number of all submitted requests |
void |
resetCounters()
Sets hits and misses counters to zero. |
Resolver<K,V> |
setResolver(Resolver<K,V> resolver)
Sets the resolver associated with this cache. |
int |
size()
Returns the number of key->value mappings in the cache. |
V |
update(K key,
V value)
Updates the value associated with the specified key in the cache if a mapping exists for the key. |
Method Detail |
---|
V put(K key, V value)
key
- key to add to the cachevalue
- value to map the key on
V get(K key)
key
- key to get the value for
V remove(K key)
key
- key to remove from the cache.
V update(K key, V value)
key
- key to change the value forvalue
- new value associated with the key
boolean containsKey(K key)
key
- key to check
void clear()
java.util.Set<K> keySet()
Set
of keys contained in the cache.int size()
K nextEvicted()
void evict()
float hitRatio()
long hits()
long misses()
long requests()
int capacity()
void resetCounters()
Resolver<K,V> getResolver()
Resolver<K,V> setResolver(Resolver<K,V> resolver)
resolver
- new resolver we want to associate with this cache.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |