public class BoundedMultiLruCache extends MultiLruCache
BaseCache.CacheItem
Modifier and Type | Field and Description |
---|---|
protected long |
currentSize |
protected long |
maxSize |
DEFAULT_HASHTABLE_SEGMENT_SIZE, listsLength, LRU_HEAD, LRU_TAIL
_rb, bucketLocks, buckets, entryCount, listeners, maxBuckets, refreshFlags, threshold
Constructor and Description |
---|
BoundedMultiLruCache() |
Modifier and Type | Method and Description |
---|---|
protected void |
decrementCurrentSize(int size) |
Object |
getStatByName(String key)
get the desired statistic counter
|
Map |
getStats()
get the stats snapshot
|
protected void |
incrementCurrentSize(int size)
synchronized counter updates
|
void |
init(int maxCapacity,
Properties props)
initialize the LRU cache
|
protected boolean |
isThresholdReached()
has cache reached its threshold
|
protected BaseCache.CacheItem |
itemAdded(BaseCache.CacheItem item)
this item is just added to the cache
|
protected void |
itemRefreshed(BaseCache.CacheItem item,
int oldSize)
item value has been refreshed
|
protected void |
itemRemoved(BaseCache.CacheItem item)
item value has been removed from the cache
|
createItem, handleOverflow, incrementTrimIndex, itemAccessed, trimLru
_put, _remove, _removeItem, add, add, addCacheListener, clear, clearStats, contains, decrementEntryCount, destroy, elements, eq, get, get, getAll, getEntryCount, getIndex, getIndex, hash, incrementAddCount, incrementEntryCount, incrementHitCount, incrementMissCount, incrementOverflowCount, incrementRefreshCount, incrementRemovalCount, init, isEmpty, keys, loadValue, notifyRefresh, put, put, remove, remove, remove, removeAll, trimExpiredEntries, trimItem, values, waitRefresh
public void init(int maxCapacity, Properties props) throws Exception
init
in interface Cache
init
in class MultiLruCache
maxCapacity
- maximum number of entries this cache may holdprops
- opaque list of properties for a given cache implementationException
protected BaseCache.CacheItem itemAdded(BaseCache.CacheItem item)
itemAdded
in class MultiLruCache
item
- CacheItem
that was createdCache bucket is already synchronized by the caller
protected void itemRefreshed(BaseCache.CacheItem item, int oldSize)
itemRefreshed
in class MultiLruCache
item
- CacheItem
that was refreshedoldSize
- size of the previous value that was refreshed
Cache bucket is already synchronized by the callerprotected void itemRemoved(BaseCache.CacheItem item)
itemRemoved
in class MultiLruCache
item
- CacheItem
that was just removed
Cache bucket is already synchronized by the caller
protected boolean isThresholdReached()
isThresholdReached
in class BaseCache
protected final void incrementCurrentSize(int size)
protected final void decrementCurrentSize(int size)
public Object getStatByName(String key)
getStatByName
in interface Cache
getStatByName
in class MultiLruCache
key
- to corresponding statpublic Map getStats()
MultiLruCache
getStats
in interface Cache
getStats
in class MultiLruCache
Copyright © 2006–2018 TinyGroup. All rights reserved.