K
- type of the stored keysV
- type of the stored valuespublic interface Cache<K,V>
Modifier and Type | Method and Description |
---|---|
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.
|
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.
|
V put(K key, V value)
key
- key to add to the cachevalue
- value to map the key onV get(K key)
key
- key to get the value forV 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 keyboolean containsKey(K key)
key
- key to checkvoid clear()
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()
Copyright © 2016 Egothor. All Rights Reserved.