| Modifier and Type | Class and Description |
|---|---|
| private static class | |
| private static class |
| Modifier and Type | Field and Description |
|---|---|
| pack-priv Map | |
| private static final LRUCacheCheapRead. | |
| pack-priv final int | |
| pack-priv final ReentrantLock |
| Access | Constructor and Description |
|---|---|
| public | LRUCacheCheapRead(int
Maximum number of items to keep. maxCacheSize)Create new cache with given maximum capacity. |
| Modifier and Type | Method and Description |
|---|---|
| public V | get(K key)
Implements abstract org. Returns the value associated with the given key. |
| public int | getMaxCacheSize()
Implements abstract org. Returns the maximum number of entries that will be stored in this cache |
| public CacheEntry | put(K key, V value)
Implements abstract org. Adds the given key and value pair into the cache |
| public void | releaseCache()
Implements abstract org. Clears all entries in the cache, for use when a known event makes the cache incorrect |
| public void | releaseMatching(CacheKeyFilter<K> filter)
Implements abstract org. This method will remove all cache entries for which this filter matches |
| private void |
| cache | back to summary |
|---|---|
| pack-priv Map<K, LRUCacheCheapRead. | |
| COMPARATOR | back to summary |
|---|---|
| private static final LRUCacheCheapRead. | |
| maxCacheSize | back to summary |
|---|---|
| pack-priv final int maxCacheSize | |
| prunningLock | back to summary |
|---|---|
| pack-priv final ReentrantLock prunningLock | |
| LRUCacheCheapRead | back to summary |
|---|---|
| public LRUCacheCheapRead(int maxCacheSize) Create new cache with given maximum capacity.
| |
| get | back to summary |
|---|---|
| public V get(K key) Implements abstract org. Doc from org. Returns the value associated with the given key. If there is no value, returns null
| |
| getMaxCacheSize | back to summary |
|---|---|
| public int getMaxCacheSize() Implements abstract org. Doc from org. Returns the maximum number of entries that will be stored in this cache
| |
| put | back to summary |
|---|---|
| public CacheEntry put(K key, V value) Implements abstract org. Doc from org. Adds the given key and value pair into the cache
| |
| releaseCache | back to summary |
|---|---|
| public void releaseCache() Implements abstract org. Doc from org. Clears all entries in the cache, for use when a known event makes the cache incorrect
| |
| releaseMatching | back to summary |
|---|---|
| public void releaseMatching(CacheKeyFilter<K> filter) Implements abstract org. Doc from org. This method will remove all cache entries for which this filter matches
| |
| removeLRUItem | back to summary |
|---|---|
| private void removeLRUItem() Remove least recently used item form the cache. No checks are done here. The method just tries to remove the least recently used cache item. An exception will be thrown if the cache is empty. | |
| Modifier and Type | Field and Description |
|---|---|
| pack-priv final K | |
| pack-priv long | |
| pack-priv final LRUCacheCheapRead | |
| pack-priv final V |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public LRUCacheCheapRead. | |
| public void | removeFromCache()
Implements org. Call this method on this entry to remove it from the LRUCache. |
| key | back to summary |
|---|---|
| pack-priv final K key | |
| lastHit | back to summary |
|---|---|
| pack-priv long lastHit | |
| parent | back to summary |
|---|---|
| pack-priv final LRUCacheCheapRead<K, V> parent | |
| value | back to summary |
|---|---|
| pack-priv final V value | |
| CacheEntryImpl | back to summary |
|---|---|
| public CacheEntryImpl(K k, V v, LRUCacheCheapRead<K, V> cache) | |
| hit | back to summary |
|---|---|
| public LRUCacheCheapRead. | |
| removeFromCache | back to summary |
|---|---|
| public void removeFromCache() Implements org. Doc from org. Call this method on this entry to remove it from the LRUCache. If this entry has already been removed this method will do nothing.
| |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public int | compare(LRUCacheCheapRead.
Implements java. Compares its two arguments for order. |
| CacheEntryImplComparator | back to summary |
|---|---|
| private CacheEntryImplComparator() | |
| compare | back to summary |
|---|---|
| public int compare(LRUCacheCheapRead. Implements java. Doc from java. Compares its two arguments for order. Returns a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second.
The implementor must ensure that
The implementor must also ensure that the relation is transitive:
Finally, the implementor must ensure that
| |