|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.castor.cache.AbstractBaseCache
org.castor.cache.hashbelt.AbstractHashbelt
public abstract class AbstractHashbelt
An abstract, core implementation of the hashbelt functionality; individual implementations will differ on the underlying behavior.
A hashbelt has six important values which get set at initialization:
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface java.util.Map |
---|
java.util.Map.Entry<K,V> |
Field Summary | |
---|---|
static int |
DEFAULT_CAPACITY
Default capacity of cache. |
static java.lang.Class<? extends Container> |
DEFAULT_CONTAINER_CLASS
Default container class. |
static int |
DEFAULT_CONTAINERS
Default number of containers for cache. |
static int |
DEFAULT_MONITOR
Default monitor interval of cache in minutes. |
static java.lang.Class<? extends AbstractReaper> |
DEFAULT_REAPER_CLASS
Default reaper class. |
static int |
DEFAULT_TTL
Default ttl of cache in seconds. |
static java.lang.String |
PARAM_CAPACITY
Mapped initialization parameter capacity . |
static java.lang.String |
PARAM_CONTAINER_CLASS
Mapped initialization parameter container-class . |
static java.lang.String |
PARAM_CONTAINERS
Mapped initialization parameter containers . |
static java.lang.String |
PARAM_MONITOR
Mapped initialization parameter monitor . |
static java.lang.String |
PARAM_REAPER_CLASS
Mapped initialization parameter reaper-class . |
static java.lang.String |
PARAM_TTL
Mapped initialization parameter ttl . |
Fields inherited from interface org.castor.cache.Cache |
---|
DEFAULT_DEBUG, DEFAULT_NAME, DEFAULT_TYPE, PARAM_DEBUG, PARAM_NAME, PARAM_TYPE |
Constructor Summary | |
---|---|
AbstractHashbelt()
|
Method Summary | |
---|---|
void |
clear()
|
void |
close()
Life-cycle method to allow custom resource cleanup for a cache implementation. |
boolean |
containsKey(java.lang.Object key)
|
boolean |
containsValue(java.lang.Object value)
|
java.util.Set<java.util.Map.Entry<java.lang.Object,java.lang.Object>> |
entrySet()
|
int |
getCapacity()
Get real capacity of this cache. |
protected java.lang.Object |
getObjectFromCache(java.lang.Object key)
Get object currently associated with given key from cache. |
int |
getTTL()
Get real ttl of this cache. |
void |
initialize(java.util.Properties params)
Lyfe-cycle method to allow custom initialization of cache implementations. |
boolean |
isEmpty()
|
java.util.Set<java.lang.Object> |
keySet()
|
protected ReadWriteLock |
lock()
Get reference to the ReadWriteLock of this cache instance. |
protected java.lang.Object |
putObjectIntoCache(java.lang.Object key,
java.lang.Object value)
Put given value with given key in cache. |
protected java.lang.Object |
removeObjectFromCache(java.lang.Object key)
Remove any available association for given key. |
int |
size()
|
java.util.Collection<java.lang.Object> |
values()
|
Methods inherited from class org.castor.cache.AbstractBaseCache |
---|
expire, expireAll, getName, invokeMethod, invokeStaticMethod |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.castor.cache.Cache |
---|
getType |
Methods inherited from interface java.util.Map |
---|
equals, get, hashCode, put, putAll, remove |
Field Detail |
---|
public static final java.lang.String PARAM_CONTAINERS
containers
.
public static final java.lang.String PARAM_CONTAINER_CLASS
container-class
.
public static final java.lang.String PARAM_REAPER_CLASS
reaper-class
.
public static final java.lang.String PARAM_CAPACITY
capacity
.
public static final java.lang.String PARAM_TTL
ttl
.
public static final java.lang.String PARAM_MONITOR
monitor
.
public static final int DEFAULT_CONTAINERS
public static final java.lang.Class<? extends Container> DEFAULT_CONTAINER_CLASS
public static final java.lang.Class<? extends AbstractReaper> DEFAULT_REAPER_CLASS
public static final int DEFAULT_CAPACITY
public static final int DEFAULT_TTL
public static final int DEFAULT_MONITOR
Constructor Detail |
---|
public AbstractHashbelt()
Method Detail |
---|
public final void initialize(java.util.Properties params) throws CacheAcquireException
initialize
in interface Cache
initialize
in class AbstractBaseCache
params
- Parameters to initialize the cache (e.g. name, capacity).
CacheAcquireException
- If cache can not be initialized.public final void close()
close
in interface Cache
close
in class AbstractBaseCache
public final int getCapacity()
public final int getTTL()
public final int size()
public final boolean isEmpty()
public final boolean containsKey(java.lang.Object key)
public final boolean containsValue(java.lang.Object value)
public final void clear()
public final java.util.Set<java.lang.Object> keySet()
public final java.util.Collection<java.lang.Object> values()
public final java.util.Set<java.util.Map.Entry<java.lang.Object,java.lang.Object>> entrySet()
protected final ReadWriteLock lock()
protected final java.lang.Object getObjectFromCache(java.lang.Object key)
key
- The key to return the associated object for.
protected final java.lang.Object putObjectIntoCache(java.lang.Object key, java.lang.Object value)
key
- The key to associate the given value with.value
- The value to associate with given key.
null
will
be returned if no value has been associated with key.protected final java.lang.Object removeObjectFromCache(java.lang.Object key)
key
- The key to remove any previously associate value for.
null
will
be returned if no value has been associated with key.
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |