public abstract class AbstractCache extends Object implements CacheInterface
| Modifier and Type | Field and Description |
|---|---|
static org.apache.log4j.Logger |
log4j
logger
|
protected Map<Object,Object> |
m_cacheMap
cache
|
protected int |
m_cacheMaxSize
cache size
|
protected int |
m_evictCount
evict count
|
| Constructor and Description |
|---|
AbstractCache(int size,
int evictCount) |
| Modifier and Type | Method and Description |
|---|---|
protected abstract void |
evict() |
Object |
get(Object key)
Returns the value to which the specified key is cached, or null if the
cache dosn't contain the key.
|
protected abstract void |
hitAccess(Object key) |
int |
maxSize()
Returns the cache max size.
|
Object |
put(Object key,
Object val)
Associates the specified value with the specified key in the cache.
|
protected abstract void |
putAccess(Object key) |
List<Object> |
removeValues(Object value)
Removes all objects with the value from cache map.
|
int |
size()
Returns the cache size.
|
boolean |
test()
This method should be used for testing.
|
String |
toString() |
Collection<Object> |
values() |
public static org.apache.log4j.Logger log4j
protected final int m_cacheMaxSize
protected final int m_evictCount
public AbstractCache(int size,
int evictCount)
size - evictCount - public Collection<Object> values()
values in interface CacheInterfacepublic Object get(Object key)
CacheInterfaceget in interface CacheInterfacekey - the key whose associated value is to be returnedprotected abstract void hitAccess(Object key)
public int maxSize()
CacheInterfacemaxSize in interface CacheInterfacepublic Object put(Object key, Object val)
CacheInterfaceput in interface CacheInterfacekey - with which the specified value is to be associatedval - to be associated with the specified keyprotected abstract void evict()
protected abstract void putAccess(Object key)
public List<Object> removeValues(Object value)
CacheInterfaceremoveValues in interface CacheInterfacepublic int size()
CacheInterfacesize in interface CacheInterfacepublic boolean test()
CacheInterfacetest in interface CacheInterfaceCopyright © 2014. All rights reserved.