| Modifier and Type | Class and Description |
|---|---|
| private static class |
| Modifier and Type | Field and Description |
|---|---|
| private final WeakHashLRU | |
| private final WeakHashLRU | |
| private final Computable | |
| private final AtomicLong | |
| private final ReentrantLock | |
| private final int | |
| private int | |
| private final WeakHashClock | |
| private final WeakHashClock | |
| private final AtomicLong |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public void | clear()
Implements org. Clears the current cache, making the current size zero |
| public void | clearStaleReferences()
Implements org. Causes stale references to be cleared from the data structures. |
| public V | compute(K key)
Implements org. The method used to get or add values to this cache |
| public String | dumpAllLists()
Implements org. Returns a string that will contain all the elements of the four lists |
| public int | getB1Size()
Implements org. Returns the number of items in the B1 LRU |
| public int | getB2Size()
Implements org. Returns the number of items in the B2 LRU |
| public Computable | getComputable()
Implements org. The computable associated with this cache |
| public double | getHitRate()
Implements org. Returns the hit rate from the last time clear was called |
| public int | getKeySize()
Implements org. Returns the current number of keys in the cache. |
| public int | getMaxSize()
Implements org. Gets the current maximum size of the cache (the maximum number of values that will be kept by the cache). |
| public int | getP()
Implements org. Returns the value of p from the CAR algorithm, which is the target size of the t1 clock |
| public int | getT1Size()
Implements org. Returns the number of items in the T1 clock |
| public int | getT2Size()
Implements org. Returns the number of items in the T2 clock |
| private V | |
| public int | getValueSize()
Implements org. Returns the current number of values in the cache. |
| public void | releaseMatching(CacheKeyFilter<K> filter)
Implements org. Releases all key/value pairs that match the filter |
| public boolean | remove(K key)
Implements org. Used to remove a single key and value from the cache (if the value is available) |
| private void | |
| public String |
| b1 | back to summary |
|---|---|
| private final WeakHashLRU<K> b1 | |
| b2 | back to summary |
|---|---|
| private final WeakHashLRU<K> b2 | |
| computable | back to summary |
|---|---|
| private final Computable<K, V> computable | |
| hits | back to summary |
|---|---|
| private final AtomicLong hits | |
| lock | back to summary |
|---|---|
| private final ReentrantLock lock | |
| maxSize | back to summary |
|---|---|
| private final int maxSize | |
| p | back to summary |
|---|---|
| private int p | |
| t1 | back to summary |
|---|---|
| private final WeakHashClock<K, WeakCARCacheImpl. | |
| t2 | back to summary |
|---|---|
| private final WeakHashClock<K, WeakCARCacheImpl. | |
| tries | back to summary |
|---|---|
| private final AtomicLong tries | |
| WeakCARCacheImpl | back to summary |
|---|---|
| public WeakCARCacheImpl(Computable<K, V> computable, int maxSize, boolean isWeak) | |
| clear | back to summary |
|---|---|
| public void clear() Implements org. Doc from org. Clears the current cache, making the current size zero
| |
| clearStaleReferences | back to summary |
|---|---|
| public void clearStaleReferences() Implements org. Doc from org. Causes stale references to be cleared from the data structures. Since this is a weak cache the references can go away at any time, which happens whenever any operation has been performed. However, it may be the case that no operation will be performed for a while and so this method is provided to have a no-op operation to call in order to clear out any stale references
| |
| compute | back to summary |
|---|---|
| public V compute(K key) Implements org. Doc from org. The method used to get or add values to this cache
| |
| dumpAllLists | back to summary |
|---|---|
| public String dumpAllLists() Implements org. Doc from org. Returns a string that will contain all the elements of the four lists
| |
| getB1Size | back to summary |
|---|---|
| public int getB1Size() Implements org. Doc from org. Returns the number of items in the B1 LRU
| |
| getB2Size | back to summary |
|---|---|
| public int getB2Size() Implements org. Doc from org. Returns the number of items in the B2 LRU
| |
| getComputable | back to summary |
|---|---|
| public Computable Implements org. Doc from org. The computable associated with this cache
| |
| getHitRate | back to summary |
|---|---|
| public double getHitRate() Implements org. Doc from org. Returns the hit rate from the last time clear was called
| |
| getKeySize | back to summary |
|---|---|
| public int getKeySize() Implements org. Doc from org. Returns the current number of keys in the cache. Note that the number of keys can be up to 2x the maximum size of the cache
| |
| getMaxSize | back to summary |
|---|---|
| public int getMaxSize() Implements org. Doc from org. Gets the current maximum size of the cache (the maximum number of values that will be kept by the cache). Note that the number of keys kept will be 2x, where x is the maximum size of the cache (see CAR algorithm which keeps a key history)
| |
| getP | back to summary |
|---|---|
| public int getP() Implements org. Doc from org. Returns the value of p from the CAR algorithm, which is the target size of the t1 clock
| |
| getT1Size | back to summary |
|---|---|
| public int getT1Size() Implements org. Doc from org. Returns the number of items in the T1 clock
| |
| getT2Size | back to summary |
|---|---|
| public int getT2Size() Implements org. Doc from org. Returns the number of items in the T2 clock
| |
| getValueFromT | back to summary |
|---|---|
| private V getValueFromT(K key) | |
| getValueSize | back to summary |
|---|---|
| public int getValueSize() Implements org. Doc from org. Returns the current number of values in the cache. Note that the number of values can be up the maximum size of the cache
| |
| releaseMatching | back to summary |
|---|---|
| public void releaseMatching(CacheKeyFilter<K> filter) Implements org. Doc from org. Releases all key/value pairs that match the filter
| |
| remove | back to summary |
|---|---|
| public boolean remove(K key) Implements org. Doc from org. Used to remove a single key and value from the cache (if the value is available)
| |
| replace | back to summary |
|---|---|
| private void replace() | |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns a string representation of the object.
Satisfying this method's contract implies a non-
| |
| Modifier and Type | Field and Description |
|---|---|
| private volatile boolean | |
| private final V |
| Access | Constructor and Description |
|---|---|
| private |
| referenceBit | back to summary |
|---|---|
| private volatile boolean referenceBit | |
| value | back to summary |
|---|---|
| private final V value | |
| CarValue | back to summary |
|---|---|
| private CarValue(V value) | |