build-artifacts/win/product/include/gfcpp/CacheFactory.hpp

Go to the documentation of this file.
00001 #ifndef __GEMFIRE_CACHEFACTORY_H__
00002 #define __GEMFIRE_CACHEFACTORY_H__
00003 /*=========================================================================
00004  * Copyright (c) 2002-2014 Pivotal Software, Inc. All Rights Reserved.
00005  * This product is protected by U.S. and international copyright
00006  * and intellectual property laws. Pivotal products are covered by
00007  * more patents listed at http://www.pivotal.io/patents.
00008  *========================================================================
00009  */
00010 
00011 #include "gfcpp_globals.hpp"
00012 #include "gf_types.hpp"
00013 #include "DistributedSystem.hpp"
00014 #include "Cache.hpp"
00015 #include "CacheAttributes.hpp"
00016 #include "PoolFactory.hpp"
00021 #define DEFAULT_POOL_NAME "default_gemfireClientPool"
00022 
00023 namespace gemfire {
00024 
00025 class CppCacheLibrary;
00033 class CPPCACHE_EXPORT CacheFactory: public SharedBase{
00034   public:
00035 
00041   static CacheFactoryPtr createCacheFactory(const PropertiesPtr& dsProps = NULLPTR);
00042     
00046   CachePtr create();
00047 
00078    static CachePtr create(const char *name, DistributedSystemPtr& system,
00079        const char* cacheXml = 0, const CacheAttributesPtr& attrs = NULLPTR, bool ignorePdxUnreadFields = false, bool readPdxSerialized = false);
00080 
00104    static CachePtr create( const char* name, DistributedSystemPtr& system,
00105        const CacheAttributesPtr& attrs);
00106 
00116    static CachePtr getInstance(const DistributedSystemPtr& system);
00117 
00126    static CachePtr getInstanceCloseOk(const DistributedSystemPtr& system );
00127 
00128 
00135    static CachePtr getAnyInstance();
00136 
00141   static const char* getVersion();
00142 
00144   static const char* getProductDescription();
00145 
00160   CacheFactoryPtr setFreeConnectionTimeout(int connectionTimeout);
00172   CacheFactoryPtr setLoadConditioningInterval(int loadConditioningInterval);
00184   CacheFactoryPtr setSocketBufferSize(int bufferSize);
00185 
00201   CacheFactoryPtr setThreadLocalConnections(bool threadLocalConnections);
00202 
00211   CacheFactoryPtr setReadTimeout(int timeout);
00212 
00224   CacheFactoryPtr setMinConnections(int minConnections);
00225 
00237   CacheFactoryPtr setMaxConnections(int maxConnections);
00238 
00250   CacheFactoryPtr setIdleTimeout(long idleTimeout);
00251 
00261   CacheFactoryPtr setRetryAttempts(int retryAttempts);
00262 
00277   CacheFactoryPtr setPingInterval(long pingInterval);
00278 
00285   CacheFactoryPtr setUpdateLocatorListInterval(long updateLocatorListInterval);
00286 
00299   CacheFactoryPtr setStatisticInterval(int statisticInterval);
00300 
00307   CacheFactoryPtr setServerGroup(const char* group);
00308 
00321   CacheFactoryPtr addLocator(const char* host, int port);
00322 
00335   CacheFactoryPtr addServer(const char* host, int port);
00336 
00344   CacheFactoryPtr setSubscriptionEnabled(bool enabled);
00356   CacheFactoryPtr setSubscriptionRedundancy(int redundancy);
00368   CacheFactoryPtr setSubscriptionMessageTrackingTimeout(int messageTrackingTimeout);
00369 
00381   CacheFactoryPtr setSubscriptionAckInterval(int ackInterval);
00382 
00383 
00392   CacheFactoryPtr setMultiuserAuthentication(bool multiuserAuthentication);
00393 
00413    CacheFactoryPtr setPRSingleHopEnabled(bool enabled);
00414 
00431    CacheFactoryPtr setPdxIgnoreUnreadFields(bool ignore);
00432 
00448    CacheFactoryPtr setPdxReadSerialized(bool pdxReadSerialized);
00449 
00457    CacheFactoryPtr set(const char* name, const char* value);    
00458 
00459    private :
00460 
00461     PoolFactoryPtr pf; 
00462     PropertiesPtr dsProp;
00463     bool ignorePdxUnreadFields;
00464     bool pdxReadSerialized;
00465 
00466     PoolFactoryPtr getPoolFactory();
00467 
00468   static void create_(const char* name, DistributedSystemPtr& system, const char* id_data, CachePtr& cptr, bool ignorePdxUnreadFields, bool readPdxSerialized);
00469 
00470   // no instances allowed
00471   CacheFactory();
00472   CacheFactory(const PropertiesPtr dsProps);
00473   ~CacheFactory();
00474 
00475   PoolPtr determineDefaultPool(CachePtr cachePtr);
00476 
00477   static CachePtr getAnyInstance(bool throwException);
00478   static GfErrType basicGetInstance(const DistributedSystemPtr& system,
00479       bool closeOk, CachePtr& cptr);
00480 
00481   //Set very first time some creates cache
00482   static CacheFactoryPtr default_CacheFactory;   
00483   static PoolPtr createOrGetDefaultPool();
00484   static void* m_cacheMap;
00485   static void init();
00486   static void cleanup();
00487   static void handleXML( CachePtr& cachePtr, const char* cachexml, DistributedSystemPtr& system );
00488   friend class CppCacheLibrary;
00489   friend class RegionFactory;
00490   friend class RegionXmlCreation;
00491   friend class CacheXmlCreation;
00492 };
00493 }; //namespace gemfire
00494 
00495 #endif //ifndef __GEMFIRE_CACHEFACTORY_H__

GemFire C++ Cache API Documentation