public abstract class AbstractManagedDynamicCacheRegistry extends java.lang.Object implements Registry, ManagedDynamicCache, ElementUpdate
ManagedDynamicCache
registry interface.Modifier and Type | Field and Description |
---|---|
static java.lang.String |
COPYRIGHT
IBM copyright notice field.
|
Constructor and Description |
---|
AbstractManagedDynamicCacheRegistry() |
Modifier and Type | Method and Description |
---|---|
void |
addElement(java.lang.Object key,
java.lang.Object cacheObject)
This method adds an element to the cache.
|
abstract java.lang.Object |
createKey(java.lang.String strKey)
This method creates a cache key for this registry based on a string representation of the key.
|
abstract java.lang.String |
createKeyString(TypedProperty prop)
This method creates a string representation of a cache key for this registry based on the input properties.
|
java.lang.Object |
findObject(java.lang.Object key)
This method gets an object from the registry.
|
com.ibm.commerce.registry.LRUDynamicHashtable |
getCache()
This method gets the cache.
|
int |
getCacheSize()
This method returns the total number of cache entries.
|
java.lang.Object |
getElement(java.lang.Object key)
This method gets an element from the cache.
|
int |
getElementCount()
This method gets the current number of cached elements.
|
java.util.Enumeration |
getElements()
This method gets an enumeration of all cached elements.
|
long |
getEvictions()
This method returns the number of entries that have been removed from the cache by an
LRU
(least-recently-used) algorithm. |
long |
getHits()
This method returns the number of cache hits.
|
java.util.Enumeration |
getKeys()
This method gets an enumeration of all cached keys.
|
long |
getMisses()
This method returns the number of cache misses.
|
int |
getUsedCacheSize()
This method returns the number of currently contained cache entries.
|
void |
initialize()
This method initializes the registry.
|
abstract void |
populate(com.ibm.commerce.registry.LRUDynamicHashtable aCache)
This method populates the cache object.
|
void |
refresh()
This method refreshes all the elements in the cache.
|
void |
removeAllElements()
This method removes all cached elements.
|
void |
removeElement(java.lang.Object key)
This method removes an element from the cache.
|
abstract java.lang.Object |
retrieve(java.lang.Object key)
This method retrieves an object from the database and adds it to the registry.
|
void |
setCache(com.ibm.commerce.registry.LRUDynamicHashtable cache)
This method sets the cache.
|
void |
setCacheSize(int size)
This method specifies the maximum cache size.
|
void |
setInitialCapacity(int initialCapacity)
This method sets the initial capacity of the registry.
|
void |
setLoadFactor(float loadFactor)
This method sets the load factor of the registry.
|
void |
update(java.lang.String action,
java.lang.Object key)
This method updates a cached element.
|
public static final java.lang.String COPYRIGHT
public abstract java.lang.Object retrieve(java.lang.Object key) throws java.lang.Exception
key
- A key used to identify the object to be retrieved.java.lang.Exception
- Thrown if the object cannot be retrieved from database.public abstract void populate(com.ibm.commerce.registry.LRUDynamicHashtable aCache) throws java.lang.Exception
no op
if this registry
supports lazy fetch.key
- A key used to identify the object to be retrieved.java.lang.Exception
- Thrown if the object cannot be found in the database and populated to the cache.public abstract java.lang.String createKeyString(TypedProperty prop) throws java.lang.Exception
createKeyString
in interface ElementUpdate
prop
- The input properties used to construct 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)
key
- The cache key.cacheObject
- An object to be cached.public java.lang.Object getElement(java.lang.Object key)
getElement
in interface ElementUpdate
key
- The cache key.public 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.java.lang.Exception
- Thrown if the object cannot be found in database.public void initialize() throws java.lang.Exception
initialCapacity
(if set)
will be used to construct the dynamic cache. The registry will then be populated by calling the
populate
method.initialize
in interface Registry
java.lang.Exception
- during initialization.public void refresh() throws 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. For example, a delete or an update.key
- The cache key.java.lang.Exception
public void removeAllElements()
public void removeElement(java.lang.Object key)
key
- The cache key.public int getCacheSize()
getCacheSize
in interface ManagedDynamicCache
public long getMisses()
getMisses
in interface ManagedDynamicCache
public long getEvictions()
LRU
(least-recently-used) algorithm.getEvictions
in interface ManagedDynamicCache
public long getHits()
getHits
in interface ManagedDynamicCache
public int getUsedCacheSize()
getUsedCacheSize
in interface ManagedDynamicCache
public void setCacheSize(int size)
The
- size of the cache.public void setInitialCapacity(int initialCapacity)
setInitialCapacity
in interface ManagedDynamicCache
The
- initial capacity of the registry.public void setLoadFactor(float loadFactor)
The
- load factor of the registry.public com.ibm.commerce.registry.LRUDynamicHashtable getCache()
LRUDynamicHashtable
object.public void setCache(com.ibm.commerce.registry.LRUDynamicHashtable cache)
cache
- The cache to set.