Package org.apache.wiki.providers
Class CachingProvider
- java.lang.Object
-
- org.apache.wiki.providers.CachingProvider
-
- All Implemented Interfaces:
PageProvider,WikiProvider
public class CachingProvider extends java.lang.Object implements PageProvider
Provides a caching page provider. This class rests on top of a real provider class and provides a cache to speed things up. Only if the cache copy of the page text has expired, we fetch it from the provider.This class does not detect if someone has modified the page externally, not through JSPWiki routines.
Heavily based on ideas by Chris Brooking.
Since 2.10 uses the Ehcache library.
- Since:
- 1.6.4
-
-
Field Summary
-
Fields inherited from interface org.apache.wiki.api.providers.WikiProvider
LATEST_VERSION
-
-
Constructor Summary
Constructors Constructor Description CachingProvider()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddeletePage(java.lang.String pageName)voiddeleteVersion(java.lang.String pageName, int version)java.util.Collection<SearchResult>findPages(QueryItem[] query)java.util.Collection<Page>getAllChangedSince(java.util.Date date)java.util.Collection<Page>getAllPages()intgetPageCount()PagegetPageInfo(java.lang.String pageName, int version)java.lang.StringgetPageText(java.lang.String pageName, int version)java.lang.StringgetProviderInfo()Gets the provider class name, and cache statistics (misscount and hitcount of page cache and history cache).PageProvidergetRealProvider()Returns the actual used provider.java.util.List<Page>getVersionHistory(java.lang.String pageName)voidinitialize(Engine engine, java.util.Properties properties)voidmovePage(java.lang.String from, java.lang.String to)booleanpageExists(java.lang.String pageName)booleanpageExists(java.lang.String pageName, int version)voidputPageText(Page page, java.lang.String text)
-
-
-
Constructor Detail
-
CachingProvider
public CachingProvider()
-
-
Method Detail
-
initialize
public void initialize(Engine engine, java.util.Properties properties) throws NoRequiredPropertyException, java.io.IOException
- Specified by:
initializein interfaceWikiProvider- Throws:
NoRequiredPropertyExceptionjava.io.IOException
-
pageExists
public boolean pageExists(java.lang.String pageName, int version)
- Specified by:
pageExistsin interfacePageProvider
-
pageExists
public boolean pageExists(java.lang.String pageName)
- Specified by:
pageExistsin interfacePageProvider
-
getPageText
public java.lang.String getPageText(java.lang.String pageName, int version) throws ProviderException
- Specified by:
getPageTextin interfacePageProvider- Throws:
ProviderException
-
putPageText
public void putPageText(Page page, java.lang.String text) throws ProviderException
- Specified by:
putPageTextin interfacePageProvider- Throws:
ProviderException
-
getAllPages
public java.util.Collection<Page> getAllPages() throws ProviderException
- Specified by:
getAllPagesin interfacePageProvider- Throws:
ProviderException
-
getAllChangedSince
public java.util.Collection<Page> getAllChangedSince(java.util.Date date)
- Specified by:
getAllChangedSincein interfacePageProvider
-
getPageCount
public int getPageCount() throws ProviderException
- Specified by:
getPageCountin interfacePageProvider- Throws:
ProviderException
-
findPages
public java.util.Collection<SearchResult> findPages(QueryItem[] query)
- Specified by:
findPagesin interfacePageProvider
-
getPageInfo
public Page getPageInfo(java.lang.String pageName, int version) throws ProviderException
- Specified by:
getPageInfoin interfacePageProvider- Throws:
ProviderException
-
getVersionHistory
public java.util.List<Page> getVersionHistory(java.lang.String pageName) throws ProviderException
- Specified by:
getVersionHistoryin interfacePageProvider- Throws:
ProviderException
-
getProviderInfo
public java.lang.String getProviderInfo()
Gets the provider class name, and cache statistics (misscount and hitcount of page cache and history cache).- Specified by:
getProviderInfoin interfaceWikiProvider- Returns:
- A plain string with all the above-mentioned values.
-
deleteVersion
public void deleteVersion(java.lang.String pageName, int version) throws ProviderException
- Specified by:
deleteVersionin interfacePageProvider- Throws:
ProviderException
-
deletePage
public void deletePage(java.lang.String pageName) throws ProviderException
- Specified by:
deletePagein interfacePageProvider- Throws:
ProviderException
-
movePage
public void movePage(java.lang.String from, java.lang.String to) throws ProviderException
- Specified by:
movePagein interfacePageProvider- Throws:
ProviderException
-
getRealProvider
public PageProvider getRealProvider()
Returns the actual used provider.- Returns:
- The real provider.
- Since:
- 2.0
-
-