|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.apache.manifoldcf.core.cachemanager.CacheManager
public class CacheManager
This class implements the cache manager interface, and provides generic cache management services. See the interface for a description of how the services work. However, since this service requires the lock manager, and there is one lock manager per thread, there will be one of these service instances per thread as well.
| Nested Class Summary | |
|---|---|
protected class |
CacheManager.CacheCreateHandle
This is the local implementation of ICacheCreateHandle |
protected class |
CacheManager.CacheHandle
This is the local implementation of ICacheHandle. |
protected class |
CacheManager.CacheTransactionHandle
This is the class the cache manager uses to keep track of transaction relationships and data. |
| Field Summary | |
|---|---|
static java.lang.String |
_rcsid
|
protected static GeneralCache |
cache
|
protected static java.lang.String |
cacheLockPrefix
|
protected ILockManager |
lockManager
|
protected java.util.HashMap |
transactionHash
|
| Constructor Summary | |
|---|---|
CacheManager(IThreadContext context)
|
|
| Method Summary | |
|---|---|
void |
commitTransaction(java.lang.String transactionID)
Commit a cache transaction. |
ICacheHandle |
enterCache(ICacheDescription[] locateObjectDescriptions,
StringSet invalidateKeys,
java.lang.String transactionID)
Second way of doing cache management. |
ICacheCreateHandle |
enterCreateSection(ICacheHandle handle)
Enter a creation critical section. |
void |
expireObjects(long currentTimestamp)
Timed invalidation. |
void |
findObjectsAndExecute(ICacheDescription[] locateObjectDescriptions,
StringSet invalidateKeys,
ICacheExecutor execObject,
java.lang.String transactionID)
Locate or create a set of objects in the cached object pool, and/or destroy and invalidate the same or other objects. |
protected boolean |
hasExpired(java.lang.String key,
long createTime)
Check if object has expired (by looking at file system). |
void |
invalidateKeys(ICacheHandle handle)
Invalidate keys. |
void |
leaveCache(ICacheHandle handle)
Leave the cache. |
void |
leaveCreateSection(ICacheCreateHandle handle)
Leave the create section. |
java.lang.Object |
lookupObject(ICacheCreateHandle handle,
ICacheDescription objectDescription)
Lookup an object. |
protected void |
performInvalidation(StringSet keys)
Perform an invalidation. |
protected long |
readSharedData(java.lang.String key)
Read an invalidation file contents. |
protected void |
resetObjectExpiration(ICacheDescription objectDescription,
long currentTime)
Set object's expiration and LRU. |
void |
rollbackTransaction(java.lang.String transactionID)
Roll back a cache transaction. |
void |
saveObject(ICacheCreateHandle handle,
ICacheDescription objectDescription,
java.lang.Object object)
Save a newly created object. |
void |
startTransaction(java.lang.String startingTransactionID,
java.lang.String enclosingTransactionID)
Begin a cache transaction. |
protected void |
writeSharedData(java.lang.String key,
long value)
Write the invalidation file contents. |
| 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 _rcsid
protected static final java.lang.String cacheLockPrefix
protected ILockManager lockManager
protected static GeneralCache cache
protected java.util.HashMap transactionHash
| Constructor Detail |
|---|
public CacheManager(IThreadContext context)
throws ManifoldCFException
ManifoldCFException| Method Detail |
|---|
public void findObjectsAndExecute(ICacheDescription[] locateObjectDescriptions,
StringSet invalidateKeys,
ICacheExecutor execObject,
java.lang.String transactionID)
throws ManifoldCFException
findObjectsAndExecute in interface ICacheManagerlocateObjectDescriptions - is a set of description objects that uniquely describe the objects needed.invalidateKeys - is the set of keys to invalidate at the end of the execution.execObject - is the cache execution object whose create() or execute() methods will
be called.transactionID - is the current transaction identifier, or null. Objects created within this call
will be associated with this transaction; they will be purged from the cache should the transaction
be rolled back.
ManifoldCFException
public ICacheHandle enterCache(ICacheDescription[] locateObjectDescriptions,
StringSet invalidateKeys,
java.lang.String transactionID)
throws ManifoldCFException
enterCache in interface ICacheManagerlocateObjectDescriptions - is a set of description objects that uniquely describe the objects needed.
May be null if no objects are desired.invalidateKeys - are the keys to invalidate after successful execution. May be null.transactionID - is the current transaction identifier, or null. Objects created within this block
will be associated with this transaction; they will be purged from the cache should the transaction
be rolled back.
ManifoldCFException
public ICacheCreateHandle enterCreateSection(ICacheHandle handle)
throws ManifoldCFException
enterCreateSection in interface ICacheManagerhandle - is the cache handle.
ManifoldCFException
public java.lang.Object lookupObject(ICacheCreateHandle handle,
ICacheDescription objectDescription)
throws ManifoldCFException
lookupObject in interface ICacheManagerhandle - is the handle to use for the create.objectDescription - is the description of the object to look up.
ManifoldCFException
protected boolean hasExpired(java.lang.String key,
long createTime)
throws ManifoldCFException
key - is the invalidation key.createTime - is the creation time.
ManifoldCFException
protected void resetObjectExpiration(ICacheDescription objectDescription,
long currentTime)
objectDescription - is the description object.currentTime - is the current time in milliseconds since epoch.
public void saveObject(ICacheCreateHandle handle,
ICacheDescription objectDescription,
java.lang.Object object)
throws ManifoldCFException
saveObject in interface ICacheManagerhandle - is the create handle.objectDescription - is the object description.object - is the object.
ManifoldCFException
public void leaveCreateSection(ICacheCreateHandle handle)
throws ManifoldCFException
leaveCreateSection in interface ICacheManagerhandle - is the handle created by the corresponding enterCreateSection() method.
ManifoldCFException
public void invalidateKeys(ICacheHandle handle)
throws ManifoldCFException
invalidateKeys in interface ICacheManagerhandle - is the cache handle. Does nothing if a null set of keys was passed in.
ManifoldCFException
protected void performInvalidation(StringSet keys)
throws ManifoldCFException
keys - is the set of keys to invalidate.
ManifoldCFException
public void leaveCache(ICacheHandle handle)
throws ManifoldCFException
leaveCache in interface ICacheManagerhandle - is the handle of the cache we are leaving.
ManifoldCFException
public void startTransaction(java.lang.String startingTransactionID,
java.lang.String enclosingTransactionID)
throws ManifoldCFException
startTransaction in interface ICacheManagerstartingTransactionID - is the id of the transaction that is starting.enclosingTransactionID - is the id of the transaction that is in effect, or null.
ManifoldCFException
public void commitTransaction(java.lang.String transactionID)
throws ManifoldCFException
commitTransaction in interface ICacheManagertransactionID - is the id of the transaction that is ending.
ManifoldCFException
public void rollbackTransaction(java.lang.String transactionID)
throws ManifoldCFException
rollbackTransaction in interface ICacheManagertransactionID - is the id of the transaction that is ending.
ManifoldCFException
public void expireObjects(long currentTimestamp)
throws ManifoldCFException
expireObjects in interface ICacheManagercurrentTimestamp - is the current time in milliseconds since epoch.
ManifoldCFException
protected long readSharedData(java.lang.String key)
throws ManifoldCFException
key - is the cache key name.
ManifoldCFException
protected void writeSharedData(java.lang.String key,
long value)
throws ManifoldCFException
key - is the cache key name.value - is the invalidation timestamp.
ManifoldCFException
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||