com.zwares.base.cache
Class Cache
java.lang.Object
|
+--com.zwares.base.cache.Cache
- public class Cache
- extends java.lang.Object
|
Constructor Summary |
Cache()
|
Cache(int maxSize)
|
Cache(int maxSize,
long longetivity)
|
Cache(int maxSize,
long longetivity,
Clock clock)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
BYTES_PER_KILOBYTE
public static final int BYTES_PER_KILOBYTE
- See Also:
- Constant Field Values
DEFAULT_MAX_SIZE
public static final int DEFAULT_MAX_SIZE
- See Also:
- Constant Field Values
DEFAULT_REFRESH_INTERVAL
public static final int DEFAULT_REFRESH_INTERVAL
- See Also:
- Constant Field Values
DEFAULT_CLOCK_REFRESH_INTERVAL
public static final int DEFAULT_CLOCK_REFRESH_INTERVAL
- See Also:
- Constant Field Values
_objectLookUp
protected java.util.Map _objectLookUp
_mostRecentlyUsed
protected DoublyLinkedList _mostRecentlyUsed
_mostRecentlyExpired
protected DoublyLinkedList _mostRecentlyExpired
_maxSize
protected int _maxSize
_currentSize
protected int _currentSize
_cacheHits
protected long _cacheHits
_cacheMisses
protected long _cacheMisses
_clock
protected Clock _clock
_sharedClock
protected static Clock _sharedClock
_longetivity
protected long _longetivity
Cache
public Cache()
Cache
public Cache(int maxSize)
Cache
public Cache(int maxSize,
long longetivity)
Cache
public Cache(int maxSize,
long longetivity,
Clock clock)
getCurrentSize
public int getCurrentSize()
getNumberOfCacheHits
public long getNumberOfCacheHits()
getNumberOfCacheMisses
public long getNumberOfCacheMisses()
promote
protected void promote(Cache.CachedObject co)
remove
public Cacheable remove(java.lang.Object key)
evict
protected int evict(int minSize)
evictExpired
protected int evictExpired()
evictLeastRecentlyUsed
protected int evictLeastRecentlyUsed()
evictLeastRecentlyUsed
protected int evictLeastRecentlyUsed(int minSize)
put
public Cacheable put(java.lang.Object key,
Cacheable obj)
get
public Cacheable get(java.lang.Object key)
toString
public java.lang.String toString()
- Overrides:
toString in class java.lang.Object
main
public static void main(java.lang.String[] args)