public interface WeakCARCache<K,V>
As a quick review, the CAR algorithm maintains four lists:
Modifier and Type | Method and Description |
---|---|
void |
clear()
Clears the current cache, making the current size zero
|
void |
clearStaleReferences()
Causes stale references to be cleared from the data
structures.
|
V |
compute(K key)
The method used to get or add values to this cache
|
String |
dumpAllLists()
Returns a string that will contain all the elements of the four lists
|
int |
getB1Size()
Returns the number of items in the B1 LRU
|
int |
getB2Size()
Returns the number of items in the B2 LRU
|
Computable<K,V> |
getComputable()
The computable associated with this cache
|
double |
getHitRate()
Returns the hit rate from the last time clear was called
|
int |
getKeySize()
Returns the current number of keys in the cache.
|
int |
getMaxSize()
Gets the current maximum size of the cache (the maximum
number of values that will be kept by the cache).
|
int |
getP()
Returns the value of p from the CAR algorithm, which
is the target size of the t1 clock
|
int |
getT1Size()
Returns the number of items in the T1 clock
|
int |
getT2Size()
Returns the number of items in the T2 clock
|
int |
getValueSize()
Returns the current number of values in the cache.
|
void |
releaseMatching(CacheKeyFilter<K> filter)
Releases all key/value pairs that match the filter
|
boolean |
remove(K key)
Used to remove a single key and value from the cache (if
the value is available)
|
V compute(K key)
key
- The key to add to the cache. If the value
is not found, then the computable will be called to
get the value. May not be nullint getKeySize()
int getValueSize()
int getT1Size()
int getT2Size()
int getB1Size()
int getB2Size()
void clear()
int getMaxSize()
Computable<K,V> getComputable()
boolean remove(K key)
key
- The key to remove. May not be nullvoid releaseMatching(CacheKeyFilter<K> filter)
filter
- A non-null filter that can be used
to delete every key/value pair that matches the filtervoid clearStaleReferences()
int getP()
String dumpAllLists()
double getHitRate()
Copyright © 2009-2017, Oracle and/or its affiliates. All Rights Reserved.