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
`CachingProvider()`

### Method Summary

All Methods Instance Methods Concrete Methods
`void` `deletePage​(java.lang.String pageName)`
`void` `deleteVersion​(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()`
`int` `getPageCount()`
`Page` `getPageInfo​(java.lang.String pageName, int version)`
`java.lang.String` `getPageText​(java.lang.String pageName, int version)`
`java.lang.String` `getProviderInfo()` Gets the provider class name, and cache statistics (misscount and hitcount of page cache and history cache).
`PageProvider` `getRealProvider()` Returns the actual used provider.
`java.util.List<Page>` `getVersionHistory​(java.lang.String pageName)`
`void` `initialize​(Engine engine, java.util.Properties properties)`
`void` `movePage​(java.lang.String from, java.lang.String to)`
`boolean` `pageExists​(java.lang.String pageName)`
`boolean` `pageExists​(java.lang.String pageName, int version)`
`void` `putPageText​(Page page, java.lang.String text)`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### CachingProvider

    public CachingProvider()

### Method Detail

#### initialize

    public void initialize​(Engine engine,
                           java.util.Properties properties)
                    throws NoRequiredPropertyException,
                           java.io.IOException

Specified by:
  `initialize` in interface `WikiProvider`
Throws:
  `NoRequiredPropertyException`
  `java.io.IOException`

#### pageExists

    public boolean pageExists​(java.lang.String pageName,
                              int version)

Specified by:
  `pageExists` in interface `PageProvider`

#### pageExists

    public boolean pageExists​(java.lang.String pageName)

Specified by:
  `pageExists` in interface `PageProvider`

#### getPageText

    public java.lang.String getPageText​(java.lang.String pageName,
                                        int version)
                                 throws ProviderException

Specified by:
  `getPageText` in interface `PageProvider`
Throws:
  `ProviderException`

#### putPageText

    public void putPageText​(Page page,
                            java.lang.String text)
                     throws ProviderException

Specified by:
  `putPageText` in interface `PageProvider`
Throws:
  `ProviderException`

#### getAllPages

    public java.util.Collection<Page> getAllPages()
                                           throws ProviderException

Specified by:
  `getAllPages` in interface `PageProvider`
Throws:
  `ProviderException`

#### getAllChangedSince

    public java.util.Collection<Page> getAllChangedSince​(java.util.Date date)

Specified by:
  `getAllChangedSince` in interface `PageProvider`

#### getPageCount

    public int getPageCount()
                     throws ProviderException

Specified by:
  `getPageCount` in interface `PageProvider`
Throws:
  `ProviderException`

#### findPages

    public java.util.Collection<SearchResult> findPages​(QueryItem[] query)

Specified by:
  `findPages` in interface `PageProvider`

#### getPageInfo

    public Page getPageInfo​(java.lang.String pageName,
                            int version)
                     throws ProviderException

Specified by:
  `getPageInfo` in interface `PageProvider`
Throws:
  `ProviderException`

#### getVersionHistory

    public java.util.List<Page> getVersionHistory​(java.lang.String pageName)
                                           throws ProviderException

Specified by:
  `getVersionHistory` in interface `PageProvider`
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:
  `getProviderInfo` in interface `WikiProvider`
Returns:
  A plain string with all the above-mentioned values.

#### deleteVersion

    public void deleteVersion​(java.lang.String pageName,
                              int version)
                       throws ProviderException

Specified by:
  `deleteVersion` in interface `PageProvider`
Throws:
  `ProviderException`

#### deletePage

    public void deletePage​(java.lang.String pageName)
                    throws ProviderException

Specified by:
  `deletePage` in interface `PageProvider`
Throws:
  `ProviderException`

#### movePage

    public void movePage​(java.lang.String from,
                         java.lang.String to)
                  throws ProviderException

Specified by:
  `movePage` in interface `PageProvider`
Throws:
  `ProviderException`

#### getRealProvider

    public PageProvider getRealProvider()

Returns the actual used provider.

Returns:
  The real provider.
Since:
  2.0