cache-mapping

cache-mapping

Used in: caching-scheme-mapping

Description

Each cache-mapping element specifyies the cache-scheme which is to be used for a given cache name or pattern.

Elements

The following table describes the elements you can define within the cache-mapping element.

Element Required/Optional Description
<cache-name> Required Specifies a cache name or name pattern. The name is unique within a cache factory.

The following cache name patterns are supported:

  • exact match, i.e. "MyCache"
  • prefix match, i.e. "My*" that matches to any cache name starting with "My"
  • any match "*", that matches to any cache name

The patterns get matched in the order of specificity (more specific definition is selected whenever possible). For example, if both "MyCache" and "My*" mappings are specified, the scheme from the "MyCache" mapping will be used to configure a cache named "MyCache".

<scheme-name> Required Contains the caching scheme name. The name is unique within a configuration file.

Caching schemes are configured in the caching-schemes section.
<init-params> Optional Allows specifying replaceable cache scheme parameters.

During cache scheme parsing, any occurrence of any replaceable parameter in format "{parameter-name}" is replaced with the corresponding parameter value.

Consider the following cache mapping example:
<cache-mapping>
  <cache-name>My*</cache-name>
  <scheme-name>my-scheme</scheme-name>
  <init-params>
    <init-param>
      <param-name>cache-loader</param-name>
      <param-value>com.acme.MyCacheLoader</param-value>
    </init-param>
    <init-param>
      <param-name>size-limit</param-name>
      <param-value>1000</param-value>
    </init-param>
  </init-params>
</cache-mapping>

For any cache name match "My*", any occurrence of the literal "{cache-loader}" in any part of the corresponding cache-scheme element will be replaced with the string "com.acme.MyCacheLoader" and any occurrence of the literal "{size-limit}" will be replaced with the value of "1000".

Since Coherence 3.0