public class WGAPIGenericCache extends java.lang.Object implements WGAPICache
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
STOREKEY_PRIVATE_EXTDATACACHE |
static java.lang.String |
STOREKEY_PRIVATE_ITEMCACHE |
static java.lang.String |
STOREKEY_PRIVATE_METACACHE |
Constructor and Description |
---|
WGAPIGenericCache() |
Modifier and Type | Method and Description |
---|---|
void |
destroy()
Callback function used, when the cache is no longer needed.
|
void |
flushAll()
Flush the whole cache, expiring all entries.
|
void |
flushDatabaseCache(WGDatabase db)
Flush the cache for the given database, including all its documents
|
void |
flushDocumentCache(WGDocument doc)
Flush the cache for the given document.
|
long |
getMaxSize()
Returns the maximum number of entries allowed in the cache
|
long |
getSize()
Returns the current number of entries in the cache
|
int |
getUtilisation()
Returns a percent value, describing how many cache retrieval operations actually could return a cache value.
|
void |
init(java.lang.String name,
int capacity)
Initialisation method
|
java.util.Map |
readExtensionDataCache(WGDocument doc)
Tries to read the extension data cache map for the given document from the cache.
|
java.util.Map |
readFileMetaDataCache(WGDocument doc)
Tries to read the fileMetadata cache map for the given document from the cache.
|
java.util.Map |
readItemCache(WGDocument doc)
Tries to read the item cache map for the given document from the cache.
|
java.util.Map |
readMetaCache(WGDocument doc)
Tries to read the metadata cache map for the given document from the cache.
|
java.util.Map |
readRelationCache(WGDocument doc)
Tries to read the relation cache map for the given document from the cache.
|
void |
writeExtensionDataCache(WGDocument doc,
java.util.Map cache)
Writes the extension data cache map for this document to the cache for later retrieval.
|
void |
writeFileMetaDataCache(WGDocument doc,
java.util.Map cache)
Writes the file meta data cache map for this document to the cache for later retrieval.
|
void |
writeItemCache(WGDocument doc,
java.util.Map cache)
Writes the item cache map for this document to the cache for later retrieval.
|
void |
writeMetaCache(WGDocument doc,
java.util.Map cache)
Writes the metadata cache map for this document to the cache for later retrieval.
|
void |
writeRelationCache(WGDocument doc,
java.util.Map cache)
Writes the relation cache map for this document to the cache for later retrieval.
|
public static final java.lang.String STOREKEY_PRIVATE_METACACHE
public static final java.lang.String STOREKEY_PRIVATE_EXTDATACACHE
public static final java.lang.String STOREKEY_PRIVATE_ITEMCACHE
public void init(java.lang.String name, int capacity) throws CacheException
WGAPICache
init
in interface WGAPICache
name
- Name of the cachecapacity
- Maximum capacity (entries) of the cacheCacheException
public void destroy()
WGAPICache
destroy
in interface WGAPICache
public void writeItemCache(WGDocument doc, java.util.Map cache)
WGAPICache
writeItemCache
in interface WGAPICache
doc
- The document who's data is cached in this mapcache
- the cache mappublic void writeExtensionDataCache(WGDocument doc, java.util.Map cache)
WGAPICache
writeExtensionDataCache
in interface WGAPICache
doc
- The document who's data is cached in this mapcache
- the cache mappublic void writeFileMetaDataCache(WGDocument doc, java.util.Map cache)
WGAPICache
writeFileMetaDataCache
in interface WGAPICache
doc
- The document who's data is cached in this mapcache
- the cache mappublic void writeMetaCache(WGDocument doc, java.util.Map cache)
WGAPICache
writeMetaCache
in interface WGAPICache
doc
- The document who's data is cached in this mapcache
- the cache mappublic java.util.Map readItemCache(WGDocument doc)
WGAPICache
readItemCache
in interface WGAPICache
doc
- The document whose item cache map is to be retrievedpublic java.util.Map readExtensionDataCache(WGDocument doc)
WGAPICache
readExtensionDataCache
in interface WGAPICache
doc
- The document whose item cache map is to be retrievedpublic java.util.Map readFileMetaDataCache(WGDocument doc)
WGAPICache
readFileMetaDataCache
in interface WGAPICache
doc
- The document whose item cache map is to be retrievedpublic java.util.Map readMetaCache(WGDocument doc)
WGAPICache
readMetaCache
in interface WGAPICache
doc
- The document whose metadata cache map is to be retrievedpublic void flushDocumentCache(WGDocument doc)
WGAPICache
flushDocumentCache
in interface WGAPICache
public void flushDatabaseCache(WGDatabase db)
WGAPICache
flushDatabaseCache
in interface WGAPICache
public void flushAll()
WGAPICache
flushAll
in interface WGAPICache
public long getSize()
WGAPICache
getSize
in interface WGAPICache
public int getUtilisation()
WGAPICache
getUtilisation
in interface WGAPICache
public long getMaxSize()
WGAPICache
getMaxSize
in interface WGAPICache
public java.util.Map readRelationCache(WGDocument doc)
WGAPICache
readRelationCache
in interface WGAPICache
doc
- The document whose metadata cache map is to be retrievedpublic void writeRelationCache(WGDocument doc, java.util.Map cache)
WGAPICache
writeRelationCache
in interface WGAPICache
doc
- The document who's data is cached in this mapcache
- the cache map