| java.lang.Object | |
| ↳ | com.pnfsoftware.jeb.util.collect.CacheMap<K, V> |
A simple CacheMap, with optional support for cached entries ordering.
| Public Constructors | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
|
CacheMap(int maxSize, int evictSize, boolean ordered)
Construct a cache map.
| |||||||||||
|
CacheMap(int maxSize, int evictSize)
Construct a cache map.
| |||||||||||
|
CacheMap(int maxSize)
Construct a cache map with an eviction size equals to 25% of the cache size.
| |||||||||||
| Public Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| synchronized void | clear() | ||||||||||
| synchronized boolean | containsKey(K key) | ||||||||||
| synchronized V | get(K key) | ||||||||||
| synchronized V | put(K key, V val) | ||||||||||
| synchronized V | remove(K key) | ||||||||||
| synchronized void | removeRange(K fromKey, K toKey) | ||||||||||
| int | size() | ||||||||||
|
[Expand]
Inherited Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
| |||||||||||
Construct a cache map. Whenever an element is added and the map exceeds the maximum size, it will be partially cleaned up by evicting the last accessed objects.
| maxSize | maximum size of the cache map |
|---|---|
| evictSize | number of objects evicted during a partial cache cleanup |
| ordered | true to naturally order elements in the map |
Construct a cache map. Whenever an element is added and the map exceeds the maximum size, it will be partially cleaned up by evicting the last accessed objects.
| maxSize | maximum size of the cache map |
|---|---|
| evictSize | number of objects evicted during a partial cache cleanup |
Construct a cache map with an eviction size equals to 25% of the cache size.
| maxSize | maximum size of the map |
|---|