Used in: cache-config
The caching-schemes element defines a series of cache scheme elements. Each cache scheme defines a type of cache, for instance a database backed partitioned cache, or a local cache with an LRU eviction policy. Scheme types are bound to actual caches using cache-scheme-mappings.
Each of the cache scheme element types is used to describe a different type of cache, for instance distributed, versus replicated. Multiple instances of the same type may be defined so long as each has a unique scheme-name.
For example the following defines two different distributed schemes:
Some caching scheme types contain nested scheme definitions. For instance in the above example the distributed schemes include a nested scheme defintion describing their backing map.
Caching schemes can be defined by specifying all the elements required for a given scheme type, or by inheriting from another named scheme of the same type, and selectively overriding specific values. Scheme inheritance is accomplished by including a <scheme-ref> element in the inheriting scheme containing the scheme-name of the scheme to inherit from.
The following two configurations will produce equivalent "DistributedInMemoryCache" scheme defintions:
Please note that while the first is somewhat more compact, the second offers the ability to easily resuse the "LocalSizeLimited" scheme within multiple schemes. The following example demonstrates multiple schemes reusing the same "LocalSizeLimited" base defintion, but the second imposes a diffrent expiry-delay.
The following table describes the different types of schemes you can define within the caching-schemes element.
|<local-scheme>||Optional||Defines a cache scheme which provides on-heap cache storage.|
|<external-scheme>||Optional||Defines a cache scheme which provides off-heap cache storage, for instance on disk.|
|<paged-external-scheme>||Optional||Defines a cache scheme which provides off-heap cache storage, that is size-limited via time based paging.|
|<distributed-scheme>||Optional||Defines a cache scheme where storage of cache entries is partitioned across the cluster nodes.|
|<replicated-scheme>||Optional||Defines a cache scheme where each cache entry is stored on all cluster nodes.|
|<optimistic-scheme>||Optional||Defines a replicated cache scheme which uses optimistic rather then pessimistic locking.|
|<near-scheme>||Optional||Defines a two tier cache scheme which consists of a fast local front-tier cache of a much larger back-tier cache.|
|<versioned-near-scheme>||Optional||Defines a near-scheme which uses object versioning to ensure coherence between the front and back tiers.|
|<overflow-scheme>||Optional||Defines a two tier cache scheme where entries evicted from a size-limited front-tier overflow and are stored in a much larger back-tier cache.|
|<invocation-scheme>||Optional||Defines an invocation service which can be used for performing custom operations in parallel across cluster nodes.|
|<read-write-backing-map-scheme>||Optional||Defines a backing map scheme which provides a cache of a persistent store.|
|<versioned-backing-map-scheme>||Optional||Defines a backing map scheme which utilizes object versioning to determine what updates need to be written to the persistent store.|
|<jms-scheme>||Optional||Defines a Coherence*Extend-JMS cache scheme allowing for caches to be accessed from outside a Coherence cluster.|
|<class-scheme>||Optional|| Defines a cache scheme using a custom cache implementation.
Any custom implementation must implement the java.util.Map interface, and include a zero-parameter public constructor.
Additionally if the contents of the Map can be modified by anything other than the CacheService itself (e.g. if the Map automatically expires its entries periodically or size-limits its contents), then the returned object must implement the com.tangosol.util.ObservableMap interface.
|<disk-scheme>||Optional||Note: As of Coherence 3.0, the disk-scheme configuration element has been deprecated and replaced by the external-scheme and paged-external-scheme configuration elements.|