#include <coherence/net/CacheFactory.hpp>
Inherits Object.
One of the most common functions provided by the CacheFactory is ability to obtain an instance of a cache. There are various cache services and cache topologies that are supported by Coherence.
To get a cache reference use getCache() method.
When a cache retrieved by any of the above methods is no longer used, it is preferrable to call releaseCache to release the associated resources. To destroy all instances of the cache across the cluster, use destroyCache.
Public Types | |
typedef spec::Handle | Handle |
CacheFactory Handle definition. | |
typedef spec::View | View |
CacheFactory View definition. | |
typedef spec::Holder | Holder |
CacheFactory Holder definition. | |
Static Public Member Functions | |
static NamedCache::Handle | getCache (String::View vsName) |
Return an instance of a cache configured by the current ConfigurableCacheFactory. | |
static void | destroyCache (NamedCache::Handle hCache) |
Releases and destroys the specified NamedCache. | |
static void | releaseCache (NamedCache::Handle hCache) |
Release local resources associated with the specified instance of the cache. | |
static Service::Handle | getService (String::View vsName) |
Factory method returning an instance the named service. | |
static void | shutdown () |
Shutdown all clustered services. | |
static void | configure (XmlElement::View vXmlCache, XmlElement::View vXmlCoherence=NULL) |
Configure the CacheFactory and local member. | |
static XmlElement::Handle | loadXml (std::istream &in) |
Read an XmlElement from the supplied stream. | |
static XmlElement::Handle | loadXmlFile (String::View vsFile) |
Read an XmlElement from the named file. | |
static ConfigurableCacheFactory::Handle | getConfigurableCacheFactory () |
Obtain the ConfigurableCacheFactory singleton. | |
static void | setConfigurableCacheFactory (ConfigurableCacheFactory::Handle hFactory, OperationalContext::View vContext=NULL) |
Specify a singleton of ConfigurableCacheFactory. | |
static void | main (ObjectArray::View vasArg) |
Invoke the Coherence C++ command line tool. |
static NamedCache::Handle getCache | ( | String::View | vsName | ) | [static] |
Return an instance of a cache configured by the current ConfigurableCacheFactory.
This helper method is a simple wrapper around the ConfigurableCacheFactory::ensureCache method.
vsName | cache name (unique for a given configurable cache factory). If the NamedCache with the specified name already exists, a reference to the same object will be returned |
static void destroyCache | ( | NamedCache::Handle | hCache | ) | [static] |
Releases and destroys the specified NamedCache.
Warning: This method is used to completely destroy the specified cache across the cluster. All references in the entire cluster to this cache will be invalidated, the cached data will be cleared, and all resources will be released.
hCache | the NamedCache object to be destroyed |
static void releaseCache | ( | NamedCache::Handle | hCache | ) | [static] |
Release local resources associated with the specified instance of the cache.
Releasing a NamedCache reference makes it no longer usable, but does not affect the content of the cache. In other words, all other references to the cache will still be valid, and the cache data is not affected by releasing the reference.
The reference that is released using this method can no longer be used; any attempt to use the reference will result in an exception.
hCache | the NamedCache object to be released |
static Service::Handle getService | ( | String::View | vsName | ) | [static] |
Factory method returning an instance the named service.
vsName | service name (unique across the cluster). If the service with the specified name already exists, the reference to the same service will be returned. If the name is not specified the default service name will be used |
static void configure | ( | XmlElement::View | vXmlCache, | |
XmlElement::View | vXmlCoherence = NULL | |||
) | [static] |
Configure the CacheFactory and local member.
vXmlCache | an XML element corresponding to cache-config.dtd | |
vXmlCoherence | an XML element corresponding to coherence.dtd |
IllegalStateException | if the factory has already been configured |
static XmlElement::Handle loadXml | ( | std::istream & | in | ) | [static] |
Read an XmlElement from the supplied stream.
This method does not configure the CacheFactory, but it can be used to obtain a configuration which can be supplied to the configure method.
in | the stream from which to read the XML element |
static XmlElement::Handle loadXmlFile | ( | String::View | vsFile | ) | [static] |
Read an XmlElement from the named file.
This method does not configure the CacheFactory, but it can be used to obtain a configuration which can be supplied to the configure method.
vsFile | name of the file to read from relative to the current working directory. |
static ConfigurableCacheFactory::Handle getConfigurableCacheFactory | ( | ) | [static] |
static void setConfigurableCacheFactory | ( | ConfigurableCacheFactory::Handle | hFactory, | |
OperationalContext::View | vContext = NULL | |||
) | [static] |
Specify a singleton of ConfigurableCacheFactory.
hFactory | an instance of ConfigurableCacheFactory | |
vContext | an (optional) OperationalContext |