Pivotal GemFire Native Client Cache Reference  9.0.6
CacheFactory.hpp
Go to the documentation of this file.
1 #ifndef __GEMFIRE_CACHEFACTORY_H__
2 #define __GEMFIRE_CACHEFACTORY_H__
3 /*=========================================================================
4  * Copyright (c) 2002-2014 Pivotal Software, Inc. All Rights Reserved.
5  * This product is protected by U.S. and international copyright
6  * and intellectual property laws. Pivotal products are covered by
7  * more patents listed at http://www.pivotal.io/patents.
8  *========================================================================
9  */
10 
11 #include "gfcpp_globals.hpp"
12 #include "gf_types.hpp"
13 #include "DistributedSystem.hpp"
14 #include "Cache.hpp"
15 #include "CacheAttributes.hpp"
16 #include "PoolFactory.hpp"
21 #define DEFAULT_POOL_NAME "default_gemfireClientPool"
22 
23 namespace gemfire {
24 
25 class CppCacheLibrary;
34  public:
35 
41  static CacheFactoryPtr createCacheFactory(const PropertiesPtr& dsProps = NULLPTR);
42 
46  CachePtr create();
47 
78  static CachePtr create(const char *name, DistributedSystemPtr& system,
79  const char* cacheXml = 0, const CacheAttributesPtr& attrs = NULLPTR, bool ignorePdxUnreadFields = false, bool readPdxSerialized = false);
80 
104  static CachePtr create( const char* name, DistributedSystemPtr& system,
105  const CacheAttributesPtr& attrs);
106 
116  static CachePtr getInstance(const DistributedSystemPtr& system);
117 
126  static CachePtr getInstanceCloseOk(const DistributedSystemPtr& system );
127 
128 
135  static CachePtr getAnyInstance();
136 
141  static const char* getVersion();
142 
144  static const char* getProductDescription();
145 
160  CacheFactoryPtr setFreeConnectionTimeout(int connectionTimeout);
172  CacheFactoryPtr setLoadConditioningInterval(int loadConditioningInterval);
184  CacheFactoryPtr setSocketBufferSize(int bufferSize);
185 
201  CacheFactoryPtr setThreadLocalConnections(bool threadLocalConnections);
202 
211  CacheFactoryPtr setReadTimeout(int timeout);
212 
224  CacheFactoryPtr setMinConnections(int minConnections);
225 
237  CacheFactoryPtr setMaxConnections(int maxConnections);
238 
250  CacheFactoryPtr setIdleTimeout(long idleTimeout);
251 
261  CacheFactoryPtr setRetryAttempts(int retryAttempts);
262 
277  CacheFactoryPtr setPingInterval(long pingInterval);
278 
285  CacheFactoryPtr setUpdateLocatorListInterval(long updateLocatorListInterval);
286 
299  CacheFactoryPtr setStatisticInterval(int statisticInterval);
300 
307  CacheFactoryPtr setServerGroup(const char* group);
308 
321  CacheFactoryPtr addLocator(const char* host, int port);
322 
335  CacheFactoryPtr addServer(const char* host, int port);
336 
344  CacheFactoryPtr setSubscriptionEnabled(bool enabled);
356  CacheFactoryPtr setSubscriptionRedundancy(int redundancy);
368  CacheFactoryPtr setSubscriptionMessageTrackingTimeout(int messageTrackingTimeout);
369 
381  CacheFactoryPtr setSubscriptionAckInterval(int ackInterval);
382 
383 
392  CacheFactoryPtr setMultiuserAuthentication(bool multiuserAuthentication);
393 
413  CacheFactoryPtr setPRSingleHopEnabled(bool enabled);
414 
431  CacheFactoryPtr setPdxIgnoreUnreadFields(bool ignore);
432 
448  CacheFactoryPtr setPdxReadSerialized(bool pdxReadSerialized);
449 
457  CacheFactoryPtr set(const char* name, const char* value);
458 
459  private :
460 
461  PoolFactoryPtr pf;
462  PropertiesPtr dsProp;
463  bool ignorePdxUnreadFields;
464  bool pdxReadSerialized;
465 
466  PoolFactoryPtr getPoolFactory();
467 
468  static void create_(const char* name, DistributedSystemPtr& system, const char* id_data, CachePtr& cptr, bool ignorePdxUnreadFields, bool readPdxSerialized);
469 
470  // no instances allowed
471  CacheFactory();
472  CacheFactory(const PropertiesPtr dsProps);
473  ~CacheFactory();
474 
475  PoolPtr determineDefaultPool(CachePtr cachePtr);
476 
477  static CachePtr getAnyInstance(bool throwException);
478  static GfErrType basicGetInstance(const DistributedSystemPtr& system,
479  bool closeOk, CachePtr& cptr);
480 
481  //Set very first time some creates cache
482  static CacheFactoryPtr default_CacheFactory;
483  static PoolPtr createOrGetDefaultPool();
484  static void* m_cacheMap;
485  static void init();
486  static void cleanup();
487  static void handleXML( CachePtr& cachePtr, const char* cachexml, DistributedSystemPtr& system );
488  friend class CppCacheLibrary;
489  friend class RegionFactory;
490  friend class RegionXmlCreation;
491  friend class CacheXmlCreation;
492 };
493 }; //namespace gemfire
494 
495 #endif //ifndef __GEMFIRE_CACHEFACTORY_H__
Top level class for configuring and using GemFire on a client.This should be called once to create Ca...
Definition: CacheFactory.hpp:33
This namespace contains all the GemFire C++ API classes, enumerations and globals.
Definition: Assert.hpp:19
GfErrType
Error codes returned by GemFire C++ interface functions.
Definition: gf_base.hpp:220
#define CPPCACHE_EXPORT
Defines a GemFire CPPCACHE export.
Definition: gf_base.hpp:51
This abstract base class is the base class of all user objects that have the shared capability of ref...
Definition: SharedBase.hpp:31
Defines a reference counted shared pointer.
Definition: SharedPtr.hpp:35

GemFire C++ Cache API Documentation