org.tinygroup.jspengine.appserv.util.cache
类 MultiLruCache

java.lang.Object
  继承者 org.tinygroup.jspengine.appserv.util.cache.BaseCache
      继承者 org.tinygroup.jspengine.appserv.util.cache.MultiLruCache
所有已实现的接口:
Cache
直接已知子类:
BoundedMultiLruCache

public class MultiLruCache
extends BaseCache

MultiLruCache -- in-memory bounded LRU cache with multiple LRU lists Underlying Hashtable is made into logical segments, with each segment having its own LRU list.


嵌套类摘要
 
从类 org.tinygroup.jspengine.appserv.util.cache.BaseCache 继承的嵌套类/接口
BaseCache.CacheItem
 
字段摘要
static int DEFAULT_HASHTABLE_SEGMENT_SIZE
           
protected  int[] listsLength
           
static int LRU_HEAD
           
static int LRU_TAIL
           
 
从类 org.tinygroup.jspengine.appserv.util.cache.BaseCache 继承的字段
_rb, bucketLocks, buckets, entryCount, listeners, maxBuckets, refreshFlags, threshold
 
构造方法摘要
MultiLruCache()
           
 
方法摘要
protected  BaseCache.CacheItem createItem(int hashCode, Object key, Object value, int size)
          create new item
 Object getStatByName(String key)
          get the desired statistic counter
 Map getStats()
          get the stats snapshot
protected  void handleOverflow()
          cache has reached threshold so trim its size. subclasses are expected to provide a robust cache replacement algorithm.
protected  void incrementTrimIndex()
           
 void init(int maxCapacity, Properties props)
          initialize the LRU cache
protected  void itemAccessed(BaseCache.CacheItem item)
          this item is accessed
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
protected  BaseCache.CacheItem trimLru(int segment)
          remove an lru item from one of the LRU lists
 
从类 org.tinygroup.jspengine.appserv.util.cache.BaseCache 继承的方法
_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, isThresholdReached, keys, loadValue, notifyRefresh, put, put, remove, remove, remove, removeAll, trimExpiredEntries, trimItem, values, waitRefresh
 
从类 java.lang.Object 继承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

字段详细信息

LRU_HEAD

public static final int LRU_HEAD
另请参见:
常量字段值

LRU_TAIL

public static final int LRU_TAIL
另请参见:
常量字段值

DEFAULT_HASHTABLE_SEGMENT_SIZE

public static final int DEFAULT_HASHTABLE_SEGMENT_SIZE
另请参见:
常量字段值

listsLength

protected int[] listsLength
构造方法详细信息

MultiLruCache

public MultiLruCache()
方法详细信息

init

public void init(int maxCapacity,
                 Properties props)
          throws Exception
initialize the LRU cache

指定者:
接口 Cache 中的 init
覆盖:
BaseCache 中的 init
参数:
maxCapacity - maximum number of entries this cache may hold
props - opaque list of properties for a given cache implementation
抛出:
Exception

createItem

protected BaseCache.CacheItem createItem(int hashCode,
                                         Object key,
                                         Object value,
                                         int size)
create new item

覆盖:
BaseCache 中的 createItem
参数:
hashCode - for the entry
key - Object key
value - Object value
size - size in bytes of the item subclasses may override to provide their own CacheItem extensions e.g. one that permits persistence.

trimLru

protected BaseCache.CacheItem trimLru(int segment)
remove an lru item from one of the LRU lists

参数:
the - LRU segment index to trim
返回:
the item that was successfully trimmed

itemAdded

protected BaseCache.CacheItem itemAdded(BaseCache.CacheItem item)
this item is just added to the cache

覆盖:
BaseCache 中的 itemAdded
参数:
item - CacheItem that was created
返回:
a overflow item; may be null Cache bucket is already synchronized by the caller

itemAccessed

protected void itemAccessed(BaseCache.CacheItem item)
this item is accessed

覆盖:
BaseCache 中的 itemAccessed
参数:
item - CacheItem accessed Cache bucket is already synchronized by the caller

itemRefreshed

protected void itemRefreshed(BaseCache.CacheItem item,
                             int oldSize)
item value has been refreshed

覆盖:
BaseCache 中的 itemRefreshed
参数:
item - CacheItem that was refreshed
oldSize - size of the previous value that was refreshed Cache bucket is already synchronized by the caller

itemRemoved

protected void itemRemoved(BaseCache.CacheItem item)
item value has been removed from the cache

覆盖:
BaseCache 中的 itemRemoved
参数:
item - CacheItem that was just removed Cache bucket is already synchronized by the caller

handleOverflow

protected void handleOverflow()
cache has reached threshold so trim its size. subclasses are expected to provide a robust cache replacement algorithm.

覆盖:
BaseCache 中的 handleOverflow

incrementTrimIndex

protected void incrementTrimIndex()

getStatByName

public Object getStatByName(String key)
get the desired statistic counter

指定者:
接口 Cache 中的 getStatByName
覆盖:
BaseCache 中的 getStatByName
参数:
key - to corresponding stat
返回:
an Object corresponding to the stat See also: Constant.java for the key

getStats

public Map getStats()
get the stats snapshot

指定者:
接口 Cache 中的 getStats
覆盖:
BaseCache 中的 getStats
返回:
a Map of stats See also: Constant.java for the keys


Copyright © 2006–2014 开源组织. All rights reserved.