java.lang.Object | +--com.ibm.commerce.registry.AbstractManagedDynamicCacheRegistry
This is an abstract class that implements the ManagedDynamicCache registry interface.
Field Summary | |
---|---|
static java.lang.String |
COPYRIGHT IBM copyright notice field. |
Constructor Summary | |
---|---|
AbstractManagedDynamicCacheRegistry() |
Method Summary | |
---|---|
void |
addElement(java.lang.Object key,
java.lang.Object cacheObject) Adds an Element to the cache. |
abstract
java.lang.Object |
createKey(java.lang.String strKey) Creates a cache key for this registry based on a string representation of the key. |
abstract
java.lang.String |
createKeyString(
TypedProperty prop) Creates a string representation of a cache key for this registry based on the input properties. |
java.lang.Object |
findObject(java.lang.Object key) Gets an object from the registry. |
LRUDynamicHashtable |
getCache() Gets the cache |
int |
getCacheSize() Returns the total number of cache entries. |
java.lang.Object |
getElement(java.lang.Object key) Gets an element from the cache. |
int |
getElementCount() Gets the current number of cached elements. |
java.util.Enumeration |
getElements() Gets an enumeration of all cached elements. |
long |
getEvictions() Returns the number of entries that have been removed from the cache by LRU algorithm. |
long |
getHits() Returns the number of cache hits. |
java.util.Enumeration |
getKeys() Gets an enumeration of all cached keys. |
long |
getMisses() Returns the number of cache misses. |
int |
getUsedCacheSize() Returns the number of currently contained cache entries. |
void |
initialize() Initializes the registry. |
abstract
void |
populate(
LRUDynamicHashtable aCache) Populates the cache object. |
void |
refresh() Refreshes all the elements in the cache. |
void |
removeAllElements() Removes all cached elements. |
void |
removeElement(java.lang.Object key) Removes a element from the cache. |
abstract
java.lang.Object |
retrieve(java.lang.Object key) Retrieves an object from the database and add it to the registry. |
void |
setCache(
LRUDynamicHashtable cache) Sets the cache |
void |
setCacheSize(int size) Specifies the maximum cache size. |
void |
setInitialCapacity(int initialCapacity) Sets the initial capacity of the registry. |
void |
setLoadFactor(float loadFactor) Sets the load factor of the registry. |
void |
update(java.lang.String action, java.lang.Object key) Updates a cached element. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll,
toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String COPYRIGHT
Constructor Detail |
---|
public AbstractManagedDynamicCacheRegistry()
Method Detail |
---|
public abstract java.lang.Object retrieve(java.lang.Object key) throws java.lang.Exception
key
- - a key used to identify the object to be retrievedThe
- object ccannot be retrieved from database.java.lang.Exception
public abstract void populate(LRUDynamicHashtable aCache) throws java.lang.Exception
If
- the object cannot be found in database and populate to
the cache.java.lang.Exception
public abstract java.lang.String createKeyString(TypedProperty prop) throws java.lang.Exception
createKeyString
in interface
ElementUpdate
prop
- The input properties used to contruct the string cache
keyjava.lang.Exception
public abstract java.lang.Object createKey(java.lang.String strKey) throws java.lang.Exception
createKey
in interface
ElementUpdate
strKey
- The string representation of the cache key.java.lang.Exception
public void addElement(java.lang.Object key, java.lang.Object cacheObject)
public java.lang.Object getElement(java.lang.Object key)
getElement
in interface
ElementUpdate
key
- The cache key for the elementpublic java.util.Enumeration getElements()
public java.util.Enumeration getKeys()
public int getElementCount()
public java.lang.Object findObject(java.lang.Object key) throws java.lang.Exception
key
- The cache key.If
- the object cannot be found in database.java.lang.Exception
public void initialize() throws java.lang.Exception
initialize
in interface
Registry
java.lang.Exception
- during
initialization.public void refresh() throws java.lang.Exception
refresh
in interface
Registry
java.lang.Exception
public void update(java.lang.String action, java.lang.Object key) throws java.lang.Exception
update
in interface
ElementUpdate
action
- The action performed on the registry. e.g. delete or
update.key
- The cache key.java.lang.Exception
public void removeAllElements()
public void removeElement(java.lang.Object key)
public int getCacheSize()
getCacheSize
in interface
ManagedDynamicCache
public long getMisses()
getMisses
in interface
ManagedDynamicCache
public long getEvictions()
getEvictions
in interface
ManagedDynamicCache
public long getHits()
getHits
in interface
ManagedDynamicCache
public int getUsedCacheSize()
getUsedCacheSize
in interface
ManagedDynamicCache
public void setCacheSize(int size)
public void setInitialCapacity(int initialCapacity)
setInitialCapacity
in interface
ManagedDynamicCache
public void setLoadFactor(float loadFactor)
public LRUDynamicHashtable getCache()
public void setCache(LRUDynamicHashtable cache)
cache
- The cache to set