|Oracle® Coherence User's Guide for Oracle Coherence
Part Number E12192-01
This section describes the Near Cache as it pertains to Coherence for C++ clients. For a complete discussion of the concepts behind a Near Cache, its configuration, and ways to keep it synchronized with the back tier see "Near Cache" in "Getting Started with Oracle Coherence".
In Coherence for C++, the Near Cache is a
coherence::net::NamedCache implementation that wraps the front cache and the back cache using a read-through/write-through approach. If the back cache implements the
ObservableCache interface, then the Near Cache can use either the listen
Auto strategy to invalidate any front cache entries that might have been changed in the back cache.
A typical Near Cache is configured to use a local cache (thread safe, highly concurrent, size-limited and/or auto-expiring local cache) as the front cache and a remote cache as a back cache. A Near Cache is configured by using the near-scheme which has two child elements: a front-scheme for configuring a local (front) cache and a back-scheme for defining a remote (back) cache.
A Near Cache is configured by using the <
near-scheme> element in the
coherence-cache-config file. This element has two required subelements:
front-scheme for configuring a local (front-tier) cache and a
back-scheme for defining a remote (back-tier) cache. While a local cache (<
local-scheme>) is a typical choice for the front-tier, you can also use non-JVM heap based caches, (<
external-scheme> or <
paged-external-scheme>) or schemes based on Java objects (<
The remote or back-tier cache is described by the <
back-scheme> element. A back-tier cache can be either a distributed cache (<
distributed-scheme>) or a remote cache (<
remote-cache-scheme>). The <
remote-cache-scheme> element enables you to use a clustered cache from outside the current cluster.
Optional subelements of <
<invalidation-strategy> for specifying how the front-tier and back-tier objects will be kept synchronized and <
listener> for specifying a listener which will be notified of events occurring on the cache.
A reference to a configured Near Cache can be obtained by name by using the
Instances of all
NamedCache implementations, including
NearCache, should be explicitly released by calling the
NamedCache::release() method when they are no longer needed, to free up any resources they might hold.
If the particular
NamedCache is used for the duration of the application, then the resources will be cleaned up when the application is shut down or otherwise stops. However, if it is only used for a period, the application should call its
release() method when finished using it.