public class LooselyBoundedCache extends BoundedCache
Modifier and Type | Field and Description |
---|---|
protected long |
m_AccessSequence
The access sequence.
|
protected int |
m_CacheCountEstimate
The estimate of the current cache count
|
protected int |
m_Capacity
Target max hashtable capacity; alos used as initial Capacity
in hashtable constructor
|
protected int |
m_EmergencyCapacityTrigger
capacity at which an "emergency" purge is performed
|
protected boolean |
m_EmergencyPurgeRequested
Emergency cache purge requested
|
protected long |
m_HitCount
The number of cache hits.
|
protected ConcurrentHashMap |
m_Items
The cache items.
|
protected long |
m_LockCount
The number of locked cache puts.
|
protected long |
m_MissCount
The number of cache misses.
|
protected int |
m_NormalCapacityTrigger
capacity at which a "normal" purge is posted
|
protected boolean |
m_NormalPurgeRequested
Normal cache purge requested
|
protected long |
m_PurgeCount
The number of cache removes.
|
protected int |
m_PurgeCycleCount
Total number of purge cycles performed
|
protected long |
m_PurgeCycleTime
Total elapsed time (in ms) of the purge cycles performed.
|
protected boolean |
m_PurgeInProgress
Cache purge in progress
|
protected int |
m_PurgeTarget
Number of items desired in the cache after a purge operation
|
protected long |
m_PutCount
The number of cache puts.
|
protected long |
m_RemoveCount
The number of cache removes.
|
protected long |
m_SequenceAtPreviousPurge
Cache purge in progress
|
protected int |
m_UrgentCapacityTrigger
capacity at which an "urgent" purge is posted
|
protected boolean |
m_UrgentPurgeRequested
Urgent cache purge requested
|
m_Configuration
Constructor and Description |
---|
LooselyBoundedCache(BoundedCacheConfiguration configuration)
Constructs an loosely bounded cache.
|
Modifier and Type | Method and Description |
---|---|
protected void |
addEntry(Object id,
LooselyBoundedCacheable value,
long seq) |
protected void |
addLockedEntry(Object id,
LooselyBoundedCacheable value) |
protected void |
checkIfPurgeNeeded() |
void |
dispose()
Disposes this cache.
|
Object |
find(Object id)
Gets an item from this cache.
|
CachePerformance |
getCachePerformance()
Gets the performance information for this cache.
|
Enumeration |
getElements()
Gets an Enumeration of the LooselyBoundedCacheable objects
in this cache.
|
void |
lock(Object id,
LooselyBoundedCacheable lbc)
Locks an item in this cache.
|
void |
lock(Object id,
Object value)
Locks an item in this cache.
|
void |
performNormalPurgeIfNeeded()
Purge Cache if a request for "normal" purge is indicated
|
void |
performUrgentPurgeIfNeeded()
Purge Cache if a request for "urgent" purge is indicated
|
protected void |
purge() |
protected void |
purgeEntry(Object id)
Purges an item from this cache.
|
void |
put(Object id,
LooselyBoundedCacheable lbc)
Puts an item in this cache.
|
void |
put(Object id,
Object value)
Puts an item in this cache.
|
void |
remove(Object id)
Removes an item from this cache.
|
void |
reset()
Resets this cache.
|
void |
resetCachePerformance()
Resets the performance information for this cache.
|
void |
setCacheConfiguration(CacheConfiguration configuration)
Alters the configuration of this cache.
|
protected void |
validateCacheConfiguration(CacheConfiguration configuration)
Validates cache configuration information.
|
getCacheConfiguration
protected ConcurrentHashMap m_Items
protected int m_Capacity
protected int m_NormalCapacityTrigger
protected int m_UrgentCapacityTrigger
protected int m_EmergencyCapacityTrigger
protected int m_PurgeTarget
protected long m_AccessSequence
protected int m_CacheCountEstimate
protected long m_SequenceAtPreviousPurge
protected int m_PurgeCycleCount
protected long m_PurgeCycleTime
protected boolean m_PurgeInProgress
protected boolean m_NormalPurgeRequested
protected boolean m_UrgentPurgeRequested
protected boolean m_EmergencyPurgeRequested
protected long m_HitCount
protected long m_MissCount
protected long m_PutCount
protected long m_LockCount
protected long m_RemoveCount
protected long m_PurgeCount
public LooselyBoundedCache(BoundedCacheConfiguration configuration) throws IfsException
configuration
- the configuration paramaters for the new cacheIfsException
public void setCacheConfiguration(CacheConfiguration configuration) throws IfsException
The following cache configuration parameters can be changed using this method:
All other cache configuration parameters specified in the CacheConfiguration are ignored.
setCacheConfiguration
in class Cache
configuration
- the configuration parameters; must be a
BoundedCacheConfigurationIfsException
- (IFS-10810) if the operation failspublic void put(Object id, Object value) throws IfsException
put
in class Cache
id
- the item idvalue
- the itemIfsException
- if the operation failspublic void put(Object id, LooselyBoundedCacheable lbc) throws IfsException
id
- the item idlbc
- the itemIfsException
- if the operation failspublic void lock(Object id, Object value) throws IfsException
lock
in class BoundedCache
id
- the item idvalue
- the itemIfsException
- if the operation failspublic void lock(Object id, LooselyBoundedCacheable lbc) throws IfsException
id
- the item idlbc
- the itemIfsException
- if the operation failspublic void remove(Object id) throws IfsException
remove
in class Cache
id
- the item idIfsException
- if the operation failsprotected void purgeEntry(Object id)
id
- the item idIfsException
- if the operation failspublic Object find(Object id) throws IfsException
find
in class Cache
id
- the item idIfsException
- if the operation failspublic void performNormalPurgeIfNeeded()
performNormalPurgeIfNeeded
in class BoundedCache
public void performUrgentPurgeIfNeeded()
performUrgentPurgeIfNeeded
in class BoundedCache
protected void purge()
protected void addEntry(Object id, LooselyBoundedCacheable value, long seq)
public Enumeration getElements() throws IfsException
getElements
in class Cache
IfsException
- if operation failsprotected void addLockedEntry(Object id, LooselyBoundedCacheable value)
protected void checkIfPurgeNeeded()
public CachePerformance getCachePerformance()
getCachePerformance
in class Cache
public void resetCachePerformance()
resetCachePerformance
in class Cache
public void reset()
This causes the cache to be emptied and its performance information to be reset.
public void dispose()
After the cache is disposed, it is invalid to use this cache.
protected void validateCacheConfiguration(CacheConfiguration configuration) throws IfsException
Checks purge target, normal capacity trigger, urgent capacity trigger, and emergency capacity trigger.
configuration
- the configuration paramaters for the new cacheIfsException
- if the configuration is not validCopyright © 2023. All rights reserved.