public static final class Store.Cache.HashTable extends Store.Cache
Fixed size cache which uses hash table. Is thread-safe and requires only minimal locking. Items are randomly removed and replaced by hash collisions.
This is simple, concurrent, small-overhead, random cache.
Store.Cache.HardRef, Store.Cache.HashTable, Store.Cache.LRU, Store.Cache.WeakSoftRef| Modifier and Type | Field and Description |
|---|---|
protected int |
cacheMaxSizeMask |
protected Object[] |
items |
protected long[] |
recids |
cacheHitCounter, cacheMissCounter, lock, NULL| Constructor and Description |
|---|
Store.Cache.HashTable(int cacheMaxSize,
boolean disableLocks) |
| Modifier and Type | Method and Description |
|---|---|
void |
clear() |
void |
close() |
Object |
get(long recid) |
Store.Cache |
newCacheForOtherSegment() |
protected int |
pos(long recid) |
void |
put(long recid,
Object item) |
metricsCacheHit, metricsCacheMissprotected final long[] recids
protected final Object[] items
protected final int cacheMaxSizeMask
public Store.Cache.HashTable(int cacheMaxSize,
boolean disableLocks)
public Object get(long recid)
get in class Store.Cachepublic void put(long recid,
Object item)
put in class Store.Cacheprotected int pos(long recid)
public void clear()
clear in class Store.Cachepublic void close()
close in class Store.Cachepublic Store.Cache newCacheForOtherSegment()
newCacheForOtherSegment in class Store.CacheCopyright © 2015. All Rights Reserved.