com.metamatrix.connector.xml.cache
Class DocumentCache
java.lang.Object
com.metamatrix.connector.xml.cache.DocumentCache
- All Implemented Interfaces:
- IDocumentCache
public class DocumentCache
- extends java.lang.Object
- implements IDocumentCache
created by JChoate on Jun 22, 2005
Provides an in memory object cache backed by a file cache. Objects entering
the cache should be Serializable if the file cache is going to be used. If
they are not serializable, the will not be written to disk, they will just be
discarded if they are removed from the in-memory cache.
The cache should be thread safe and usable by any connector (or really
anything)
Constructor Summary |
DocumentCache(int maxMemoryCacheSize,
int maxFileCacheSize,
java.lang.String fileCacheLocation,
int maxTimeToLive,
ConnectorLogger log,
java.lang.String identifier)
|
DocumentCache(int maxMemoryCacheSize,
int maxFileCacheSize,
java.lang.String fileCacheLocation,
int maxTimeToLive,
ConnectorLogger log,
java.lang.String identifier,
boolean useCleanerThread)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DocumentCache
public DocumentCache(int maxMemoryCacheSize,
int maxFileCacheSize,
java.lang.String fileCacheLocation,
int maxTimeToLive,
ConnectorLogger log,
java.lang.String identifier,
boolean useCleanerThread)
DocumentCache
public DocumentCache(int maxMemoryCacheSize,
int maxFileCacheSize,
java.lang.String fileCacheLocation,
int maxTimeToLive,
ConnectorLogger log,
java.lang.String identifier)
cacheLookup
public static XMLDocument cacheLookup(IDocumentCache cache,
java.lang.String cacheKey,
java.lang.String id)
addToCache
public void addToCache(java.lang.String cacheKey,
java.lang.Object obj,
int size,
java.lang.String id)
throws ConnectorException
- Specified by:
addToCache
in interface IDocumentCache
- Throws:
ConnectorException
release
public void release(java.lang.String cacheKey,
java.lang.String id)
- Description copied from interface:
IDocumentCache
- Called by the CachedObjectRecord contained in the connector to remove
a reference on a cache item.
- Specified by:
release
in interface IDocumentCache
fetchObject
public java.lang.Object fetchObject(java.lang.String cacheKey,
java.lang.String id)
- Specified by:
fetchObject
in interface IDocumentCache
id
- The CacheKey of the cached object.
clearCache
public void clearCache()
- Specified by:
clearCache
in interface IDocumentCache
shutdownCleaner
public void shutdownCleaner(boolean waitForShutdown)
throws java.lang.InterruptedException
- Throws:
java.lang.InterruptedException
shutdownCleaner
public void shutdownCleaner()
- Specified by:
shutdownCleaner
in interface IDocumentCache
getCurrentMemoryCacheSize
protected int getCurrentMemoryCacheSize()
getCurrentFileCacheSize
protected int getCurrentFileCacheSize()
getCacheCount
protected int getCacheCount()
getCacheContents
protected java.util.Enumeration getCacheContents()
dumpCache
protected void dumpCache()
Copyright © 2009. All Rights Reserved.