java.util.Map<java.lang.Object,java.lang.Object>
, Cache
FIFOHashbelt
, LRUHashbelt
public abstract class AbstractHashbelt extends AbstractBaseCache
A hashbelt has six important values which get set at initialization:
Modifier and Type | Field | Description |
---|---|---|
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 . |
DEFAULT_DEBUG, DEFAULT_NAME, DEFAULT_TYPE, PARAM_DEBUG, PARAM_NAME, PARAM_TYPE
Constructor | Description |
---|---|
AbstractHashbelt() |
Modifier and Type | Method | Description |
---|---|---|
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() |
expire, expireAll, getName, invokeMethod, invokeStaticMethod
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
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.Intalio Inc. (C) 1999-2008. All rights reserved http://www.intalio.com