Third-Party Cache Support for WMTS

In addition to the default file-based tile cache, WMTS supports third-party cache implementations that are compliant with the JCache (JSR-107) specification. Apache JCS2.1, for example, can be used to put the cached tiles into a single disk file or even in a database (see the JCS2.1 document for more details). To use a JCache implementation, specify the provider class in the Cache section in WMTS service configuration. All required jars (third-party cache implementation and dependencies) must be placed in Spectrum\server\modules\spatial\lib in order for Spectrum Spatial to find the classes.

Below is the Cache section of the WMTS configuration for JCS2.1. It uses an optional property to specify the location of the JCS-specific cache configuration.

<ns5:Cache enabled="true" cachingProvider="org.apache.commons.jcs.jcache.JCSCachingProvider">
  <ns5:Property name="ConfigFileURI" value="file:///C:/Program%20Files/Precisely/Spectrum/server/modules/spatial/cache.ccf"/>
There are optional properties can be used with JCache providers:
  • TileKeyPattern - the pattern of the cache key; for example, "{TileMatrix} - {TileCol} - {TileRow}.{Format}"
  • EmptyTileKeyPattern - the pattern of the cache key for a tile that serves empty tiles. This tile will be returned when the required tile is not found in the cache. It is useful for pre-generated tiles where only non-empty tiles are generated. For a pre-generated tile set, users may only create non-empty tiles. When serving this kind of tile set, the required tile may not be in the cache. By specifying this key, a pre-defined tile (for blank tile) will be returned in this case (for MVT, this tile is a zero length byte[], for raster, it will be a tile with a background style).
  • EnableJMX - enable JMX and Statistics of the cache