public class CHMCache extends Object implements NodeCache
ConcurrentHashMap. There's no eviction
policy, it just fills up until reaching the specified capacity (or
close enough at least, bounds check is not atomic :)NodeCache.Loader| Constructor and Description |
|---|
CHMCache()Create a cache with default capacity. |
CHMCache(int capacity)Create a cache with the given capacity. |
| Modifier and Type | Method and Description |
|---|---|
Object | get(int key,
NodeCache.Loader loader)Get a value from the cache, loading it if necessary. |
public CHMCache()
public CHMCache(int capacity)
capacity - the maximum number of entriespublic Object get(int key, NodeCache.Loader loader) throws IOException
NodeCacheget in interface NodeCachekey - the cache keyloader - the loader to use if the key is not in cacheIOException - if loading fails