Package org.apache.wiki.cache
Interface CachingManager
-
- All Known Implementing Classes:
EhcacheCachingManager
public interface CachingManager
Cache manager abstraction.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringCACHE_ATTACHMENTSName of the attachment cache.static java.lang.StringCACHE_ATTACHMENTS_COLLECTIONName of the collection attachment cache.static java.lang.StringCACHE_ATTACHMENTS_DYNAMICName of the dynamic attachment cache.static java.lang.StringCACHE_DOCUMENTSName of the rendering cache.static java.lang.StringCACHE_PAGESName of the page cache.static java.lang.StringCACHE_PAGES_HISTORYName of the page history cache.static java.lang.StringCACHE_PAGES_TEXTName of the page text cache.static java.lang.StringPROP_CACHE_CONF_FILEThe property value with the location of the cache configuration file.static java.lang.StringPROP_CACHE_ENABLEThe property value for setting the cache on/off.static java.lang.StringPROP_USECACHE_DEPRECATEDDeprecated.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description booleanenabled(java.lang.String cacheName)Checks if the requested cache is enabled or not.<T,E extends java.lang.Exception>
Tget(java.lang.String cacheName, java.io.Serializable key, CheckedSupplier<T,E> supplier)Returns an item from a cache.CacheInfoinfo(java.lang.String cacheName)Retrieves cache usage information.<T extends java.io.Serializable>
java.util.List<T>keys(java.lang.String cacheName)Returns the list of keys from elements present in a cache.voidput(java.lang.String cacheName, java.io.Serializable key, java.lang.Object val)Puts an item on a cache.voidremove(java.lang.String cacheName, java.io.Serializable key)Removes an item from a cache.voidshutdown()Shuts down the underlying cache manager
-
-
-
Field Detail
-
PROP_USECACHE_DEPRECATED
@Deprecated static final java.lang.String PROP_USECACHE_DEPRECATED
Deprecated.The property value for setting the cache on/off. Value is "jspwiki.usePageCache". This key is deprecated, use insteadPROP_CACHE_ENABLE.- See Also:
- Constant Field Values
-
PROP_CACHE_ENABLE
static final java.lang.String PROP_CACHE_ENABLE
The property value for setting the cache on/off. Value is "jspwiki.cache.enable".- See Also:
- Constant Field Values
-
PROP_CACHE_CONF_FILE
static final java.lang.String PROP_CACHE_CONF_FILE
The property value with the location of the cache configuration file. Value is "jspwiki.cache.config-file".- See Also:
- Constant Field Values
-
CACHE_ATTACHMENTS
static final java.lang.String CACHE_ATTACHMENTS
Name of the attachment cache.- See Also:
- Constant Field Values
-
CACHE_ATTACHMENTS_COLLECTION
static final java.lang.String CACHE_ATTACHMENTS_COLLECTION
Name of the collection attachment cache.- See Also:
- Constant Field Values
-
CACHE_ATTACHMENTS_DYNAMIC
static final java.lang.String CACHE_ATTACHMENTS_DYNAMIC
Name of the dynamic attachment cache.- See Also:
- Constant Field Values
-
CACHE_PAGES
static final java.lang.String CACHE_PAGES
Name of the page cache.- See Also:
- Constant Field Values
-
CACHE_PAGES_TEXT
static final java.lang.String CACHE_PAGES_TEXT
Name of the page text cache.- See Also:
- Constant Field Values
-
CACHE_PAGES_HISTORY
static final java.lang.String CACHE_PAGES_HISTORY
Name of the page history cache.- See Also:
- Constant Field Values
-
CACHE_DOCUMENTS
static final java.lang.String CACHE_DOCUMENTS
Name of the rendering cache.- See Also:
- Constant Field Values
-
-
Method Detail
-
shutdown
void shutdown()
Shuts down the underlying cache manager
-
enabled
boolean enabled(java.lang.String cacheName)
Checks if the requested cache is enabled or not.- Parameters:
cacheName- The cache to be queried.- Returns:
trueif the cache is enabled,falseotherwise.
-
info
CacheInfo info(java.lang.String cacheName)
Retrieves cache usage information.- Parameters:
cacheName- The cache to be queried.- Returns:
- cache usage information, or
nullif the requested cache is not enabled.
-
keys
<T extends java.io.Serializable> java.util.List<T> keys(java.lang.String cacheName)
Returns the list of keys from elements present in a cache.- Parameters:
cacheName- The cache to be queried.- Returns:
- list of keys from elements present in a cache.
-
get
<T,E extends java.lang.Exception> T get(java.lang.String cacheName, java.io.Serializable key, CheckedSupplier<T,E> supplier) throws E extends java.lang.Exception
Returns an item from a cache. If it is not found on the cache, try to retrieve from the provided supplier. If found there, put the value in the cache, and return it. Otherwise, returnnull.- Parameters:
cacheName- The cache in which the item lives.key- item's identifier.supplier- if the element is not cached, try to retrieve from the cached system.- Returns:
- The requested item or
nullif either the cache is not enabled or the item is not present on the cache / cached service. - Throws:
E- the supplier may throw a checked exception, which is propagated upwards.E extends java.lang.Exception
-
put
void put(java.lang.String cacheName, java.io.Serializable key, java.lang.Object val)
Puts an item on a cache.- Parameters:
cacheName- The cache in which the item will live.key- item's identifier.val- item to insert in the cache.
-
remove
void remove(java.lang.String cacheName, java.io.Serializable key)
Removes an item from a cache.- Parameters:
cacheName- The cache in which the item to be removed lives.key- item's identifier.
-
-