Oracle Coherence for C++ API
Release 3.6.0.0

E15728-01

CacheFactory Class Reference

#include <coherence/net/CacheFactory.hpp>

Inherits Object.

List of all members.


Detailed Description

Factory for the Oracle Coherence for C++ cache product.

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)
 Specify a singleton of ConfigurableCacheFactory.
static bool isSubjectScoped ()
 Indicates if Subject scope is enabled by the operational configuration.
static void main (ObjectArray::View vasArg)
 Invoke the Coherence C++ command line tool.


Member Function Documentation

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.

Parameters:
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
Returns:
a handle to the NamedCache object

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.

Parameters:
hCache the NamedCache object to be destroyed
See also:
releaseCache

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.

Parameters:
hCache the NamedCache object to be released
See also:
destroyCache

static Service::Handle getService ( String::View  vsName  )  [static]

Factory method returning an instance the named service.

Parameters:
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
Returns:
an instance of the running service

static void configure ( XmlElement::View  vXmlCache,
XmlElement::View  vXmlCoherence = NULL 
) [static]

Configure the CacheFactory and local member.

Parameters:
vXmlCache an XML element corresponding to cache-config.dtd
vXmlCoherence an XML element corresponding to coherence.dtd
Exceptions:
IllegalStateException if the factory has already been configured
See also:
loadXml to read an XmlElement from an std::istream or file

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.

Parameters:
in the stream from which to read the XML element
Returns:
the XmlElement

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.

Parameters:
vsFile name of the file to read from relative to the current working directory.
Returns:
the XmlElement

static ConfigurableCacheFactory::Handle getConfigurableCacheFactory (  )  [static]

Obtain the ConfigurableCacheFactory singleton.

Returns:
an instance of ConfigurableCacheFactory

static void setConfigurableCacheFactory ( ConfigurableCacheFactory::Handle  hFactory  )  [static]

Specify a singleton of ConfigurableCacheFactory.

Parameters:
hFactory an instance of ConfigurableCacheFactory


The documentation for this class was generated from the following file:
Copyright © 2000, 2010, Oracle and/or its affiliates. All rights reserved.