Red Hat Data Grid HotRod C++ Client  7.2.0
Public Member Functions | List of all members
infinispan::hotrod::RemoteCacheManager Class Reference

#include <RemoteCacheManager.h>

Public Member Functions

 RemoteCacheManager (bool start_=true)
 
 RemoteCacheManager (const std::map< std::string, std::string > &configuration, bool start_=true)
 
 RemoteCacheManager (const Configuration &configuration, bool start=true)
 
 ~RemoteCacheManager ()
 
void start ()
 
void stop ()
 
bool isStarted ()
 
const ConfigurationgetConfiguration ()
 
template<class K , class V >
RemoteCache< K, V > & getCache (bool forceReturnValue)
 
template<class K , class V >
RemoteCache< K, V > & getCache ()
 
template<class K , class V >
RemoteCache< K, V > & getCache (const std::string &name, bool forceReturnValue)
 
template<class K , class V >
RemoteCache< K, V > & getCache (const std::string &name)
 
template<class K , class V >
RemoteCache< K, V > & getCache (Marshaller< K > *km, void(*kd)(Marshaller< K > *), Marshaller< V > *vm, void(*vd)(Marshaller< V > *), bool forceReturnValue)
 
template<class K , class V >
RemoteCache< K, V > & getCache (Marshaller< K > *km, void(*kd)(Marshaller< K > *), Marshaller< V > *vm, void(*vd)(Marshaller< V > *))
 
template<class K , class V >
RemoteCache< K, V > & getCache (Marshaller< K > *km, void(*kd)(Marshaller< K > *), Marshaller< V > *vm, void(*vd)(Marshaller< V > *), const std::string &name, bool forceReturnValue)
 
template<class K , class V >
RemoteCache< K, V > & getCache (Marshaller< K > *km, void(*kd)(Marshaller< K > *), Marshaller< V > *vm, void(*vd)(Marshaller< V > *), const std::string &name)
 
bool switchToDefaultCluster ()
 
bool switchToCluster (std::string clusterName)
 

Detailed Description

Factory for RemoteCache objects.

Lifecycle:

In order to be able to use an instance of RemoteCache, the RemoteCacheManager must be started first. Beside other things, this instantiates connections to Hot Rod server(s). Starting the RemoteCacheManager can be done either at creation by passing start==true to constructor or after construction by calling start() method.

RemoteCacheManager is an "expensive" object, as it manages a set of persistent TCP connections to the Hot Rod servers. It is recommended to only have one instance of it per runtime and to cache it between calls to the server (i.e. remoteCache operations).

After you are done with RemoteCacheManager stop needs to be called explicitly in order to release all the resources (e.g. threads, TCP connections).

Configuration:

The cache manager is configured through a Configuration object passed to the constructor.

Constructor & Destructor Documentation

infinispan::hotrod::RemoteCacheManager::RemoteCacheManager ( bool  start_ = true)
explicit

Creates a new instance of RemoteCacheManager using the default Configuration object an an optional boolean parameter indicating whether to also start this RemoteCacheManager as well.

Parameters
start_optional boolean parameter indicating whether to start this RemoteCacheManager
infinispan::hotrod::RemoteCacheManager::RemoteCacheManager ( const std::map< std::string, std::string > &  configuration,
bool  start_ = true 
)
inlineexplicit
infinispan::hotrod::RemoteCacheManager::RemoteCacheManager ( const Configuration configuration,
bool  start = true 
)
explicit

Creates a new instance of RemoteCacheManager given an accompanying Configuration object an an optional boolean parameter indicating whether to also start this RemoteCacheManager as well.

Parameters
configurationthe Configuration reference to use for configuration of this RemoteCacheManager
startoptional boolean parameter indicating whether to start this RemoteCacheManager
infinispan::hotrod::RemoteCacheManager::~RemoteCacheManager ( )

Member Function Documentation

template<class K , class V >
RemoteCache<K, V>& infinispan::hotrod::RemoteCacheManager::getCache ( bool  forceReturnValue)
inline

Returns a RemoteCache instance connected to the default cache

Parameters
forceReturnValueif true, force all the HotRod operation that have optional return to always return a value
Returns
a RemoteCache instance connected to the default cache
template<class K , class V >
RemoteCache<K, V>& infinispan::hotrod::RemoteCacheManager::getCache ( )
inline

Returns a RemoteCache instance connected to the default cache

The Configuration.forceReturnValue policy will be used

Returns
a RemoteCache instance connected to the default cache
template<class K , class V >
RemoteCache<K, V>& infinispan::hotrod::RemoteCacheManager::getCache ( const std::string &  name,
bool  forceReturnValue 
)
inline

Returns a RemoteCache instance connected to the cache with the given name

Parameters
namethe cache name
forceReturnValueif true, force all the HotRod operation that have optional return to always return a value
Returns
a RemoteCache instance connected to the cache with the given name
template<class K , class V >
RemoteCache<K, V>& infinispan::hotrod::RemoteCacheManager::getCache ( const std::string &  name)
inline

Returns a RemoteCache instance connected to the cache with the given name

The Configuration.forceReturnValue policy will be used

Parameters
namethe cache name
Returns
a RemoteCache instance connected to the cache with the given name
template<class K , class V >
RemoteCache<K, V>& infinispan::hotrod::RemoteCacheManager::getCache ( Marshaller< K > *  km,
void(*)(Marshaller< K > *)  kd,
Marshaller< V > *  vm,
void(*)(Marshaller< V > *)  vd,
bool  forceReturnValue 
)
inline

Returns a RemoteCache instance connected to the default cache

Parameters
kmthe key marshaller
kdfunction used as key marshaller destructor after this is no longer needed
vmthe value marshaller
vdfunction used as value marshaller destructor after this is no longer needed
forceReturnValueif true, force all the HotRod operation that have optional return to always return a value
Returns
a RemoteCache instance connected to the default cache
template<class K , class V >
RemoteCache<K, V>& infinispan::hotrod::RemoteCacheManager::getCache ( Marshaller< K > *  km,
void(*)(Marshaller< K > *)  kd,
Marshaller< V > *  vm,
void(*)(Marshaller< V > *)  vd 
)
inline

Returns a RemoteCache instance connected to the default cache

The Configuration.forceReturnValue policy will be used

Parameters
kmthe key marshaller
kdfunction used as key marshaller destructor after this is no longer needed
vmthe value marshaller
vdfunction used as value marshaller destructor after this is no longer needed will indeed return a value.
Returns
a RemoteCache instance connected to the default cache
template<class K , class V >
RemoteCache<K, V>& infinispan::hotrod::RemoteCacheManager::getCache ( Marshaller< K > *  km,
void(*)(Marshaller< K > *)  kd,
Marshaller< V > *  vm,
void(*)(Marshaller< V > *)  vd,
const std::string &  name,
bool  forceReturnValue 
)
inline

Returns a RemoteCache instance connected to the cache with the given name

Parameters
kmthe key marshaller
kdfunction used as key marshaller destructor after this is no longer needed
vmthe value marshaller
vdfunction used as value marshaller destructor after this is no longer needed
namethe cache name to connect to on a remote Infinispan server
forceReturnValueif true, force all the HotRod operation that have optional return to always return a value
Returns
a RemoteCache instance connected to the cache with the given name
template<class K , class V >
RemoteCache<K, V>& infinispan::hotrod::RemoteCacheManager::getCache ( Marshaller< K > *  km,
void(*)(Marshaller< K > *)  kd,
Marshaller< V > *  vm,
void(*)(Marshaller< V > *)  vd,
const std::string &  name 
)
inline

Returns a RemoteCache instance connected to the cache with the given name

Parameters
kmthe key marshaller
kdfunction used as key marshaller destructor after this is no longer needed
vmthe value marshaller
vdfunction used as value marshaller destructor after this is no longer needed
namethe cache name to connect to on a remote Infinispan server
Returns
a RemoteCache instance connected to the cache with the given name
const Configuration& infinispan::hotrod::RemoteCacheManager::getConfiguration ( )

Returns the Configuration instance used for configuration of this RemoteCacheManager

Returns
the Configuration instance of this RemoteCacheManager
bool infinispan::hotrod::RemoteCacheManager::isStarted ( )

Returns true if this RemoteCacheManager has already been started

Returns
true if this RemoteCacheManager has already been started, false otherwise
void infinispan::hotrod::RemoteCacheManager::start ( )

Starts this RemoteCacheManager if it already has not been started

void infinispan::hotrod::RemoteCacheManager::stop ( )

Stops this RemoteCacheManager and releases all related resource

bool infinispan::hotrod::RemoteCacheManager::switchToCluster ( std::string  clusterName)

Switch the client on the main cluster

Returns
ClusterStatus::SWITCHED or ClusterStatus::NOT_SWITCHED if the named cluster doesn't exists
bool infinispan::hotrod::RemoteCacheManager::switchToDefaultCluster ( )

Switch the client on the main cluster

Returns
ClusterStatus::SWITCHED or ClusterStatus::NOT_SWITCHED if no fully working cluster is available

The documentation for this class was generated from the following file: