Apache Geode Native C++ Reference 1.15.0
apache::geode::client::CacheFactory Class Reference

Top level class for configuring and using Geode on a client.This should be called once to create Cache. More...

#include <CacheFactory.hpp>

Public Member Functions

 CacheFactory () noexcept
 To create the instance of CacheFactory. More...
 
 CacheFactory (const std::shared_ptr< Properties > &properties) noexcept
 To create the instance of CacheFactory. More...
 
Cache create () const
 To create the instance of Cache. More...
 
CacheFactoryset (std::string name, std::string value)
 Sets a geode property that will be used when creating the {link @Cache}. More...
 
CacheFactorysetAuthInitialize (const std::shared_ptr< AuthInitialize > &authInitialize)
 Sets the AuthInitializer defined by the user. More...
 
CacheFactorysetPdxIgnoreUnreadFields (bool ignore)
 Control whether pdx ignores fields that were unread during deserialization. More...
 
CacheFactorysetPdxReadSerialized (bool pdxReadSerialized)
 Sets the object preference to PdxInstance type. More...
 

Static Public Member Functions

static const std::string & getProductDescription ()
 Returns the product description string including product name and version. More...
 
static const std::string & getVersion ()
 Returns the version of the cache implementation. More...
 

Detailed Description

Top level class for configuring and using Geode on a client.This should be called once to create Cache.

For the default values for the pool attributes see PoolFactory. To create additional Pools see PoolManager

Constructor & Destructor Documentation

◆ CacheFactory() [1/2]

apache::geode::client::CacheFactory::CacheFactory ( )
noexcept

To create the instance of CacheFactory.

◆ CacheFactory() [2/2]

apache::geode::client::CacheFactory::CacheFactory ( const std::shared_ptr< Properties > &  properties)
explicitnoexcept

To create the instance of CacheFactory.

Parameters
propertiesProperties which are applicable at client level.

Member Function Documentation

◆ create()

Cache apache::geode::client::CacheFactory::create ( ) const

To create the instance of Cache.

◆ getProductDescription()

static const std::string & apache::geode::client::CacheFactory::getProductDescription ( )
static

Returns the product description string including product name and version.

◆ getVersion()

static const std::string & apache::geode::client::CacheFactory::getVersion ( )
static

Returns the version of the cache implementation.

For the 1.0 release of Geode, the string returned is 1.0.

Returns
the version of the cache implementation as a String

◆ set()

CacheFactory & apache::geode::client::CacheFactory::set ( std::string  name,
std::string  value 
)

Sets a geode property that will be used when creating the {link @Cache}.

Parameters
namethe name of the geode property
valuethe value of the geode property
Returns
a reference to this
Since
3.5

◆ setAuthInitialize()

CacheFactory & apache::geode::client::CacheFactory::setAuthInitialize ( const std::shared_ptr< AuthInitialize > &  authInitialize)

Sets the AuthInitializer defined by the user.

The AuthInitializer will be used to obtain credentials for a client.

Parameters
authInitializethe authInitialize to set
Returns
this ClientCacheFactory

◆ setPdxIgnoreUnreadFields()

CacheFactory & apache::geode::client::CacheFactory::setPdxIgnoreUnreadFields ( bool  ignore)

Control whether pdx ignores fields that were unread during deserialization.

The default is to preserve unread fields be including their data during serialization. But if you configure the cache to ignore unread fields then their data will be lost during serialization.

You should only set this attribute to true if you know this member will only be reading cache data. In this use case you do not need to pay the cost of preserving the unread fields since you will never be reserializing pdx data.

Parameters
ignoretrue if fields not read during pdx deserialization should be ignored; false, the default, if they should be preserved.
Returns
this CacheFactory
Since
3.6

◆ setPdxReadSerialized()

CacheFactory & apache::geode::client::CacheFactory::setPdxReadSerialized ( bool  pdxReadSerialized)

Sets the object preference to PdxInstance type.

When a cached object that was serialized as a PDX is read from the cache a PdxInstance will be returned instead of the actual domain class. The PdxInstance is an interface that provides run time access to the fields of a PDX without deserializing the entire PDX. The PdxInstance implementation is a light weight wrapper that simply refers to the raw bytes of the PDX that are kept in the cache. Using this method applications can choose to access PdxInstance instead of C++ object.

Note that a PdxInstance is only returned if a serialized PDX is found in the cache. If the cache contains a deserialized PDX, then a domain class instance is returned instead of a PdxInstance.

Parameters
pdxReadSerializedtrue to prefer PdxInstance
Returns
this ClientCacheFactory

Apache Geode C++ Cache API Documentation