geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dgkim...@apache.org
Subject [geode-native] branch develop updated: GEODE-3645: Update CacheFactory::create to return Cache by value (#159)
Date Thu, 30 Nov 2017 19:35:58 GMT
This is an automated email from the ASF dual-hosted git repository.

dgkimura pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/geode-native.git


The following commit(s) were added to refs/heads/develop by this push:
     new dd9a18d  GEODE-3645: Update CacheFactory::create to return Cache by value (#159)
dd9a18d is described below

commit dd9a18d913485eb8ab0e9ebf9315c1ea07d6f1c1
Author: David Kimura <dkimura@pivotal.io>
AuthorDate: Thu Nov 30 11:35:56 2017 -0800

    GEODE-3645: Update CacheFactory::create to return Cache by value (#159)
---
 clicache/src/CacheFactory.cpp                      |   4 +-
 clicache/src/DistributedSystem.cpp                 |   4 +-
 clicache/src/LocalRegion.cpp                       |   6 +-
 clicache/src/Region.cpp                            |  10 +-
 cppcache/include/geode/Cache.hpp                   |   2 +
 cppcache/include/geode/CacheFactory.hpp            |   7 +-
 cppcache/include/geode/DistributedSystem.hpp       |   6 +-
 cppcache/include/geode/PoolManager.hpp             |   4 +-
 cppcache/include/geode/Region.hpp                  |   6 +-
 cppcache/include/geode/TypeRegistry.hpp            |   8 +-
 cppcache/integration-test/CacheHelper.cpp          |  24 +++--
 cppcache/integration-test/QueryHelper.hpp          |   2 +-
 .../ThinClientLocalCacheLoader.hpp                 |   2 +-
 .../integration-test/ThinClientMultipleCaches.hpp  |   6 +-
 .../integration-test/testAttributesFactory.cpp     |   4 +-
 .../integration-test/testAttributesMutator.cpp     |   2 +-
 cppcache/integration-test/testCache.cpp            |   2 +-
 cppcache/integration-test/testConnect.cpp          |   4 +-
 cppcache/integration-test/testExpiration.cpp       |   2 +-
 cppcache/integration-test/testLinkage.cpp          |   2 +-
 .../integration-test/testOverflowPutGetSqLite.cpp  |  15 ++-
 cppcache/integration-test/testPoolFactory.cpp      |   5 +-
 .../integration-test/testRegionTemplateArgs.cpp    |   2 +-
 .../integration-test/testThinClientCqDurable.cpp   |   6 +-
 .../testXmlCacheCreationWithOverFlow.cpp           |  15 ++-
 .../testXmlCacheCreationWithPools.cpp              |  18 ++--
 .../testXmlCacheCreationWithRefid.cpp              |   3 +-
 cppcache/src/Cache.cpp                             |  51 ++++++----
 cppcache/src/CacheFactory.cpp                      | 103 ++++++++++-----------
 cppcache/src/CacheImpl.cpp                         |  21 +++--
 cppcache/src/CacheImpl.hpp                         |   8 +-
 cppcache/src/CacheTransactionManagerImpl.cpp       |  21 ++---
 cppcache/src/CacheTransactionManagerImpl.hpp       |   4 +-
 cppcache/src/DistributedSystem.cpp                 |  55 +++++------
 cppcache/src/FunctionService.cpp                   |   6 +-
 .../src/InternalCacheTransactionManager2PCImpl.cpp |   2 +-
 .../src/InternalCacheTransactionManager2PCImpl.hpp |   2 +-
 cppcache/src/LocalRegion.cpp                       |   2 +-
 cppcache/src/PdxTypeRegistry.cpp                   |  16 ++--
 cppcache/src/PdxTypeRegistry.hpp                   |   4 +-
 cppcache/src/PoolManager.cpp                       |  12 ++-
 cppcache/src/ProxyRegion.hpp                       |   2 +-
 cppcache/src/Region.cpp                            |   2 +-
 cppcache/src/RegionInternal.cpp                    |   2 +-
 cppcache/src/RegionInternal.hpp                    |   2 +-
 cppcache/src/ThinClientPoolDM.cpp                  |   2 +-
 cppcache/src/ThinClientPoolRegion.cpp              |   2 +-
 cppcache/src/ThinClientRegion.cpp                  |  10 +-
 cppcache/src/TypeRegistry.cpp                      |  17 ++--
 cppcache/src/statistics/HostStatSampler.cpp        |   2 +-
 cppcache/src/statistics/HostStatSampler.hpp        |   4 +-
 cppcache/src/statistics/StatArchiveWriter.cpp      |  11 ++-
 cppcache/src/statistics/StatArchiveWriter.hpp      |  10 +-
 cppcache/src/statistics/StatisticsManager.cpp      |   2 +-
 cppcache/src/statistics/StatisticsManager.hpp      |   3 +-
 cppcache/test/PdxLocalReaderTest.cpp               |   2 +-
 sqliteimpl/SqLiteImpl.cpp                          |  12 +--
 tests/cpp/fwklib/FrameworkTest.cpp                 |   2 +-
 tests/cpp/fwklib/FwkObjects.cpp                    |   4 +-
 59 files changed, 299 insertions(+), 270 deletions(-)

diff --git a/clicache/src/CacheFactory.cpp b/clicache/src/CacheFactory.cpp
index f2f6300..11de85a 100644
--- a/clicache/src/CacheFactory.cpp
+++ b/clicache/src/CacheFactory.cpp
@@ -60,12 +60,10 @@ namespace Apache
 				bool pdxIgnoreUnreadFields = false;
         bool pdxReadSerialized = false;
 				bool appDomainEnable = false; 
-        std::shared_ptr<native::Cache> nativeCache = nullptr;
         _GF_MG_EXCEPTION_TRY2
           //msclr::lock lockInstance(m_singletonSync);
           DistributedSystem::acquireDisconnectLock();
-    
-          nativeCache = m_nativeptr->get()->create( );
+          auto nativeCache = std::make_shared<native::Cache>(m_nativeptr->get()->create( ));
 
           auto cache = Cache::Create( nativeCache );
           CacheResolver::Add(nativeCache.get(), cache);
diff --git a/clicache/src/DistributedSystem.cpp b/clicache/src/DistributedSystem.cpp
index 27d961e..01018a0 100644
--- a/clicache/src/DistributedSystem.cpp
+++ b/clicache/src/DistributedSystem.cpp
@@ -140,9 +140,9 @@ namespace Apache
 
         // this we are calling after all .NET initialization required in
         // each AppDomain
-        auto nativeptr = native::DistributedSystem::create(mg_name.CharPtr, cache->GetNative().get(),
+        auto nativeptr = native::DistributedSystem::create(mg_name.CharPtr,
                                                             config->GetNative());
-        nativeptr->connect();
+        nativeptr->connect(cache->GetNative().get());
 
         ManagedPostConnect(cache);
 
diff --git a/clicache/src/LocalRegion.cpp b/clicache/src/LocalRegion.cpp
index 821c28b..782ad35 100644
--- a/clicache/src/LocalRegion.cpp
+++ b/clicache/src/LocalRegion.cpp
@@ -201,8 +201,8 @@ namespace Apache
           {
             return false;
           }
-          std::unique_ptr<apache::geode::client::DataOutput> out1 = m_nativeptr->get_shared_ptr()->getCache()->createDataOutput();
-          std::unique_ptr<apache::geode::client::DataOutput> out2 = m_nativeptr->get_shared_ptr()->getCache()->createDataOutput();
+          auto out1 = m_nativeptr->get_shared_ptr()->getCache().createDataOutput();
+          auto out2 = m_nativeptr->get_shared_ptr()->getCache().createDataOutput();
           val1->toData(*out1);
           val2->toData(*out2);
           if ( out1->getBufferLength() != out2->getBufferLength() )
@@ -823,7 +823,7 @@ namespace Apache
       generic<class TKey, class TValue>
       IRegionService^ LocalRegion<TKey, TValue>::RegionService::get()
       {        
-        return CacheResolver::Lookup(m_nativeptr->get()->getCache().get());
+        return CacheResolver::Lookup(&m_nativeptr->get()->getCache());
       }
 
       generic<class TKey, class TValue>
diff --git a/clicache/src/Region.cpp b/clicache/src/Region.cpp
index db9288c..789eadc 100644
--- a/clicache/src/Region.cpp
+++ b/clicache/src/Region.cpp
@@ -102,7 +102,7 @@ namespace Apache
           auto rAttributes = this->Attributes;
           auto poolName = rAttributes->PoolName;
           if (poolName != nullptr) {
-            auto poolManager = gcnew PoolManager(m_nativeptr->get()->getCache()->getPoolManager());
+            auto poolManager = gcnew PoolManager(m_nativeptr->get()->getCache().getPoolManager());
             auto pool = poolManager->Find(poolName);
             if (pool != nullptr && !pool->Destroyed) {
               return pool->MultiuserAuthentication;
@@ -244,8 +244,8 @@ namespace Apache
           {
             return false;
           }
-          std::unique_ptr<native::DataOutput> out1 = m_nativeptr->get_shared_ptr()->getCache()->createDataOutput();
-          std::unique_ptr<native::DataOutput> out2 = m_nativeptr->get_shared_ptr()->getCache()->createDataOutput();
+          auto out1 = m_nativeptr->get_shared_ptr()->getCache().createDataOutput();
+          auto out2 = m_nativeptr->get_shared_ptr()->getCache().createDataOutput();
           val1->toData(*out1);
           val2->toData(*out2);
 
@@ -726,7 +726,7 @@ namespace Apache
           if (values != nullptr) {
             valuesPtr = std::make_shared<native::HashMapOfCacheable>();
           }
-         std::shared_ptr<native::Serializable> callbackptr = Serializable::GetUnmanagedValueGeneric<Object^>(callbackArg, m_nativeptr->get()->getCache().get());
+         auto callbackptr = Serializable::GetUnmanagedValueGeneric<Object^>(callbackArg, &m_nativeptr->get()->getCache());
          native::HashMapOfCacheable native_value;
           try
           {
@@ -1003,7 +1003,7 @@ namespace Apache
       generic<class TKey, class TValue>
       IRegionService^ Region<TKey, TValue>::RegionService::get()
       {
-        return CacheResolver::Lookup(m_nativeptr->get()->getCache().get());
+        return CacheResolver::Lookup(&m_nativeptr->get()->getCache());
       }
 
       generic<class TKey, class TValue>
diff --git a/cppcache/include/geode/Cache.hpp b/cppcache/include/geode/Cache.hpp
index e88766f..eb731c6 100644
--- a/cppcache/include/geode/Cache.hpp
+++ b/cppcache/include/geode/Cache.hpp
@@ -241,6 +241,8 @@ class CPPCACHE_EXPORT Cache : public GeodeCache,
    */
   virtual ~Cache();
 
+  Cache(Cache&& other) noexcept;
+
  private:
   /**
    * @brief constructors
diff --git a/cppcache/include/geode/CacheFactory.hpp b/cppcache/include/geode/CacheFactory.hpp
index 2a5211f..ccb6d0d 100644
--- a/cppcache/include/geode/CacheFactory.hpp
+++ b/cppcache/include/geode/CacheFactory.hpp
@@ -61,7 +61,7 @@ class CPPCACHE_EXPORT CacheFactory
   /**
    * To create the instance of {@link Cache}.
    */
-  std::shared_ptr<Cache> create();
+  Cache create();
 
   /** Returns the version of the cache implementation.
    * For the 1.0 release of Geode, the string returned is <code>1.0</code>.
@@ -139,13 +139,10 @@ class CPPCACHE_EXPORT CacheFactory
   bool pdxReadSerialized;
   std::shared_ptr<AuthInitialize> authInitialize;
 
-  std::shared_ptr<Cache> create(
+  Cache create(
       const char* name,
       const std::shared_ptr<CacheAttributes>& attrs = nullptr);
 
-  void create_(const char* name, const char* id_data,
-               std::shared_ptr<Cache>& cptr, bool readPdxSerialized);
-
   // no instances allowed
   CacheFactory();
   CacheFactory(const std::shared_ptr<Properties> dsProps);
diff --git a/cppcache/include/geode/DistributedSystem.hpp b/cppcache/include/geode/DistributedSystem.hpp
index 9251c23..8b4f309 100644
--- a/cppcache/include/geode/DistributedSystem.hpp
+++ b/cppcache/include/geode/DistributedSystem.hpp
@@ -64,14 +64,13 @@ class CPPCACHE_EXPORT DistributedSystem {
    *   product installation directory cannot be determined
    **/
   static std::unique_ptr<DistributedSystem> create(
-      const std::string& name, Cache* cache,
-      const std::shared_ptr<Properties>& configPtr = nullptr);
+      const std::string& name, const std::shared_ptr<Properties>& configPtr = nullptr);
 
   /**
    * @brief connects from the distributed system
    * @throws AlreadyConnectedException if this call has succeeded once before
    */
-  void connect();
+  void connect(Cache* cache);
 
   /**
    * @brief disconnect from the distributed system
@@ -104,7 +103,6 @@ class CPPCACHE_EXPORT DistributedSystem {
    * @brief constructors
    */
   DistributedSystem(const std::string& name,
-                    std::unique_ptr<statistics::StatisticsManager> statMngr,
                     std::unique_ptr<SystemProperties> sysProps);
 
  private:
diff --git a/cppcache/include/geode/PoolManager.hpp b/cppcache/include/geode/PoolManager.hpp
index 57c04de..e71f9c3 100644
--- a/cppcache/include/geode/PoolManager.hpp
+++ b/cppcache/include/geode/PoolManager.hpp
@@ -36,6 +36,7 @@ namespace client {
 
 class ThinClientPoolDM;
 class FunctionService;
+class CacheImpl;
 
 typedef std::unordered_map<std::string, std::shared_ptr<Pool>> HashMapOfPools;
 
@@ -52,7 +53,6 @@ typedef std::unordered_map<std::string, std::shared_ptr<Pool>> HashMapOfPools;
  */
 class CPPCACHE_EXPORT PoolManager {
  public:
-  PoolManager(const Cache& cache);
 
   /**
    * Creates a new {@link PoolFactory pool factory},
@@ -110,6 +110,8 @@ class CPPCACHE_EXPORT PoolManager {
   class Impl;
   std::unique_ptr<Impl, void (*)(Impl*)> m_pimpl;
 
+  PoolManager(CacheImpl* cache);
+
   friend Cache;
   friend CacheImpl;
   friend RegionFactory;
diff --git a/cppcache/include/geode/Region.hpp b/cppcache/include/geode/Region.hpp
index d5bbe34..da31e7e 100644
--- a/cppcache/include/geode/Region.hpp
+++ b/cppcache/include/geode/Region.hpp
@@ -1452,16 +1452,16 @@ class CPPCACHE_EXPORT Region : public std::enable_shared_from_this<Region> {
 
   virtual const std::shared_ptr<Pool>& getPool() = 0;
 
-  inline std::shared_ptr<Cache>& getCache() { return m_cache; }
+  inline Cache& getCache() { return *m_cache; }
 
   Region(const Region&) = delete;
   Region& operator=(const Region&) = delete;
 
  protected:
-  Region(const std::shared_ptr<Cache>& cache);
+  Region(Cache* cache);
   virtual ~Region();
 
-  mutable std::shared_ptr<Cache> m_cache;
+  mutable Cache* m_cache;
 
   FRIEND_STD_SHARED_PTR(Region)
 };
diff --git a/cppcache/include/geode/TypeRegistry.hpp b/cppcache/include/geode/TypeRegistry.hpp
index 577ff11..14b852c 100644
--- a/cppcache/include/geode/TypeRegistry.hpp
+++ b/cppcache/include/geode/TypeRegistry.hpp
@@ -26,11 +26,13 @@
 namespace apache {
 namespace geode {
 namespace client {
+
+class CacheImpl;
 class PdxSerializer;
 
 class TypeRegistry {
  public:
-  TypeRegistry(const Cache& cache);
+  TypeRegistry(CacheImpl* cache);
 
   /**
    * @brief register an instance factory method for a given type.
@@ -57,9 +59,9 @@ class TypeRegistry {
    */
   void registerPdxSerializer(std::shared_ptr<PdxSerializer> pdxSerializer);
 
- protected:
  private:
-  const Cache& m_cache;
+
+  CacheImpl* m_cache;
 };
 }  // namespace client
 }  // namespace geode
diff --git a/cppcache/integration-test/CacheHelper.cpp b/cppcache/integration-test/CacheHelper.cpp
index 28c1cb1..2ebf321 100644
--- a/cppcache/integration-test/CacheHelper.cpp
+++ b/cppcache/integration-test/CacheHelper.cpp
@@ -86,7 +86,8 @@ CacheHelper::CacheHelper(const char* member_id,
     pp = Properties::create();
   }
 
-  cachePtr = CacheFactory::createCacheFactory(pp)->create();
+  auto cacheFactory = CacheFactory::createCacheFactory(pp);
+  cachePtr = std::make_shared<Cache>(cacheFactory->create());
 
   m_doDisconnect = false;
 
@@ -115,7 +116,8 @@ CacheHelper::CacheHelper(const char* member_id, const char* cachexml,
     CacheHelper::createDuplicateXMLFile(newFile, tmpXmlFile);
     pp->insert("cache-xml-file", newFile.c_str());
   }
-  cachePtr = CacheFactory::createCacheFactory(pp)->create();
+  auto cacheFactory = CacheFactory::createCacheFactory(pp);
+  cachePtr = std::make_shared<Cache>(cacheFactory->create());
 
   m_doDisconnect = false;
 }
@@ -127,7 +129,8 @@ CacheHelper::CacheHelper(const std::shared_ptr<Properties>& configPtr,
     pp = Properties::create();
   }
 
-  cachePtr = CacheFactory::createCacheFactory(pp)->create();
+  auto cacheFactory = CacheFactory::createCacheFactory(pp);
+  cachePtr = std::make_shared<Cache>(cacheFactory->create());
 
   auto poolFactory = cachePtr->getPoolManager().createFactory();
   addServerLocatorEPs("localhost:40404", poolFactory);
@@ -156,9 +159,9 @@ CacheHelper::CacheHelper(const bool isThinclient,
   }
   try {
     LOG(" in cachehelper before createCacheFactory");
-    cachePtr = CacheFactory::createCacheFactory(pp)
-                   ->setAuthInitialize(authInitialize)
-                   ->create();
+    auto cacheFactory = CacheFactory::createCacheFactory(pp)
+                        ->setAuthInitialize(authInitialize);
+    cachePtr = std::make_shared<Cache>(cacheFactory->create());
     m_doDisconnect = false;
   } catch (const Exception& excp) {
     LOG("Geode exception while creating cache, logged in following line");
@@ -177,7 +180,8 @@ CacheHelper::CacheHelper(const bool isThinclient,
   }
   try {
     LOG(" in cachehelper before createCacheFactory");
-    cachePtr = CacheFactory::createCacheFactory(pp)->create();
+    auto cacheFactory = CacheFactory::createCacheFactory(pp);
+    cachePtr = std::make_shared<Cache>(cacheFactory->create());
     m_doDisconnect = false;
   } catch (const Exception& excp) {
     LOG("Geode exception while creating cache, logged in following line");
@@ -201,7 +205,7 @@ CacheHelper::CacheHelper(const bool isThinclient, bool pdxIgnoreUnreadFields,
     LOGINFO("pdxIgnoreUnreadFields = %d ", pdxIgnoreUnreadFields);
     cfPtr->setPdxReadSerialized(pdxReadSerialized);
     cfPtr->setPdxIgnoreUnreadFields(pdxIgnoreUnreadFields);
-    cachePtr = cfPtr->create();
+    cachePtr = std::make_shared<Cache>(cfPtr->create());
     m_doDisconnect = false;
   } catch (const Exception& excp) {
     LOG("Geode exception while creating cache, logged in following line");
@@ -225,7 +229,7 @@ CacheHelper::CacheHelper(const bool isthinClient, const char* poolName,
 
   try {
     auto cacheFac = CacheFactory::createCacheFactory(pp);
-    cachePtr = cacheFac->create();
+    cachePtr = std::make_shared<Cache>(cacheFac->create());
 
     auto poolFactory = cachePtr->getPoolManager().createFactory();
 
@@ -274,7 +278,7 @@ CacheHelper::CacheHelper(const int redundancyLevel,
   }
 
   auto cacheFac = CacheFactory::createCacheFactory(pp);
-  cachePtr = cacheFac->create();
+  cachePtr = std::make_shared<Cache>(cacheFac->create());
   m_doDisconnect = false;
 }
 
diff --git a/cppcache/integration-test/QueryHelper.hpp b/cppcache/integration-test/QueryHelper.hpp
index 8eb0b79..97eebab 100644
--- a/cppcache/integration-test/QueryHelper.hpp
+++ b/cppcache/integration-test/QueryHelper.hpp
@@ -251,7 +251,7 @@ void QueryHelper::populatePositionPdxData(std::shared_ptr<Region>& rptr,
 void QueryHelper::populatePDXObject(std::shared_ptr<Region>& rptr) {
   // Register PdxType Object
 
-  CacheImpl* cacheImpl = CacheRegionHelper::getCacheImpl(rptr->getCache().get());
+  CacheImpl* cacheImpl = CacheRegionHelper::getCacheImpl(&rptr->getCache());
   cacheImpl->getSerializationRegistry()->addPdxType(PdxTests::PdxType::createDeserializable);
   LOG("PdxObject Registered Successfully....");
 
diff --git a/cppcache/integration-test/ThinClientLocalCacheLoader.hpp b/cppcache/integration-test/ThinClientLocalCacheLoader.hpp
index 0d4484b..1f3b15a 100644
--- a/cppcache/integration-test/ThinClientLocalCacheLoader.hpp
+++ b/cppcache/integration-test/ThinClientLocalCacheLoader.hpp
@@ -104,7 +104,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, SetupClient)
     clientXml += clientXmlFile;
     auto cacheFactoryPtr = CacheFactory::createCacheFactory()->set(
         "cache-xml-file", clientXml.c_str());
-    cachePtr = cacheFactoryPtr->create();
+    cachePtr = std::make_shared<Cache>(cacheFactoryPtr->create());
     LOGINFO("Created the Geode Cache");
 
     // Get the example Region from the Cache which is declared in the Cache XML
diff --git a/cppcache/integration-test/ThinClientMultipleCaches.hpp b/cppcache/integration-test/ThinClientMultipleCaches.hpp
index 0cec164..cb9b293 100644
--- a/cppcache/integration-test/ThinClientMultipleCaches.hpp
+++ b/cppcache/integration-test/ThinClientMultipleCaches.hpp
@@ -47,7 +47,7 @@ DUNIT_TASK_DEFINITION(SERVER1, CreateServer1)
     LOG("SERVER1 started");
   }
 END_TASK_DEFINITION
-std::shared_ptr<Region> createRegionFromCache(std::shared_ptr<Cache> cache) {
+std::shared_ptr<Region> createRegionFromCache(std::shared_ptr<Cache>& cache) {
   auto poolFactory = cache->getPoolManager().createFactory();
   CacheHelper::getHelper().addServerLocatorEPs(locatorsG, poolFactory, true);
   poolFactory->create("DistRegionAck");
@@ -57,10 +57,10 @@ std::shared_ptr<Region> createRegionFromCache(std::shared_ptr<Cache> cache) {
 DUNIT_TASK_DEFINITION(CLIENT1, SetupAndTestMutlipleCaches)
   {
     auto factory = CacheFactory::createCacheFactory();
-    auto cache1 = factory->create();
+    auto cache1 = std::make_shared<Cache>(factory->create());
     auto region1 = createRegionFromCache(cache1);
 
-    auto cache2 = factory->create();
+    auto cache2 = std::make_shared<Cache>(factory->create());
     auto region2 = createRegionFromCache(cache2);
 
     region1->put("a", "key");
diff --git a/cppcache/integration-test/testAttributesFactory.cpp b/cppcache/integration-test/testAttributesFactory.cpp
index e667b5a..fdc132f 100644
--- a/cppcache/integration-test/testAttributesFactory.cpp
+++ b/cppcache/integration-test/testAttributesFactory.cpp
@@ -28,7 +28,7 @@ using namespace apache::geode::client;
 BEGIN_TEST(REGION_FACTORY)
   {
     auto cf = CacheFactory::createCacheFactory();
-    auto cache = cf->create();
+    auto cache = std::make_shared<Cache>(cf->create());
 
     auto rf = cache->createRegionFactory(LOCAL);
     /*see bug no #865 */
@@ -55,7 +55,7 @@ BEGIN_TEST(REGION_FACTORY)
     region = nullptr;
 
     auto cf1 = CacheFactory::createCacheFactory();
-    auto cache1 = cf1->create();
+    auto cache1 = std::make_shared<Cache>(cf1->create());
 
     auto rf1 = cache1->createRegionFactory(LOCAL);
     /*see bug no #865 */
diff --git a/cppcache/integration-test/testAttributesMutator.cpp b/cppcache/integration-test/testAttributesMutator.cpp
index 9ae5419..6e71b3c 100644
--- a/cppcache/integration-test/testAttributesMutator.cpp
+++ b/cppcache/integration-test/testAttributesMutator.cpp
@@ -38,7 +38,7 @@ class TestData {
 DUNIT_TASK(A, Init)
   {
     auto cacheFactoryPtr = CacheFactory::createCacheFactory();
-    Test.m_cache = cacheFactoryPtr->create();
+    Test.m_cache = std::make_shared<Cache>(cacheFactoryPtr->create());
 
     AttributesFactory af;
     af.setEntryTimeToLive(ExpirationAction::LOCAL_INVALIDATE,
diff --git a/cppcache/integration-test/testCache.cpp b/cppcache/integration-test/testCache.cpp
index c6b4606..466d353 100644
--- a/cppcache/integration-test/testCache.cpp
+++ b/cppcache/integration-test/testCache.cpp
@@ -41,7 +41,7 @@ BEGIN_TEST(CacheFunction)
   std::cout << "create Cache with name=" << host_name
             << " and unitialized system" << std::endl;
   auto cacheFactoryPtr = CacheFactory::createCacheFactory();
-  cptr = cacheFactoryPtr->create();
+  cptr = std::make_shared<Cache>(cacheFactoryPtr->create());
   AttributesFactory attrFac;
   std::shared_ptr<RegionAttributes> rAttr;
   std::cout << "create RegionAttributes" << std::endl;
diff --git a/cppcache/integration-test/testConnect.cpp b/cppcache/integration-test/testConnect.cpp
index c0be8f3..e831bee 100644
--- a/cppcache/integration-test/testConnect.cpp
+++ b/cppcache/integration-test/testConnect.cpp
@@ -26,9 +26,9 @@ const char* host_name = "Suds";
 DUNIT_TASK(s1p1, CreateRegionOne)
   {
     auto factory = CacheFactory::createCacheFactory();
-    auto cache = factory->create();
+    auto cache = std::make_shared<Cache>(factory->create());
     try {
-      cache->getDistributedSystem().connect();
+      cache->getDistributedSystem().connect(cache.get());
       FAIL("Expected an exception.");
     } catch (const AlreadyConnectedException& ex) {
       LOG("Got expected exception.");
diff --git a/cppcache/integration-test/testExpiration.cpp b/cppcache/integration-test/testExpiration.cpp
index ff578c1..842e629 100644
--- a/cppcache/integration-test/testExpiration.cpp
+++ b/cppcache/integration-test/testExpiration.cpp
@@ -36,7 +36,7 @@ size_t getNumOfEntries(std::shared_ptr<Region>& R1) {
 void startDSandCreateCache(std::shared_ptr<Cache>& cache) {
   auto pp = Properties::create();
   auto cacheFactoryPtr = CacheFactory::createCacheFactory(pp);
-  cache = cacheFactoryPtr->create();
+  cache = std::make_shared<Cache>(cacheFactoryPtr->create());
   ASSERT(cache != nullptr, "cache not equal to null expected");
 }
 
diff --git a/cppcache/integration-test/testLinkage.cpp b/cppcache/integration-test/testLinkage.cpp
index 53108e7..d2bcd86 100644
--- a/cppcache/integration-test/testLinkage.cpp
+++ b/cppcache/integration-test/testLinkage.cpp
@@ -79,7 +79,7 @@ BEGIN_TEST(LinkageTest)
 
   std::shared_ptr<Cache> cachePtr;
   auto cacheFactoryPtr = CacheFactory::createCacheFactory();
-  cachePtr = cacheFactoryPtr->create();
+  cachePtr = std::make_shared<Cache>(cacheFactoryPtr->create());
   // Cache cache;
   ASSERT((!cachePtr->isClosed()), "cache shouldn't be closed.");
   std::shared_ptr<Region> rptr;
diff --git a/cppcache/integration-test/testOverflowPutGetSqLite.cpp b/cppcache/integration-test/testOverflowPutGetSqLite.cpp
index 4ed7461..1d23b93 100644
--- a/cppcache/integration-test/testOverflowPutGetSqLite.cpp
+++ b/cppcache/integration-test/testOverflowPutGetSqLite.cpp
@@ -303,7 +303,8 @@ void createRegion(std::shared_ptr<Region>& regionPtr, const char* regionName,
                   std::shared_ptr<Properties>& cacheProps,
                   std::shared_ptr<Properties>& sqLiteProps) {
   auto cacheFactoryPtr = CacheFactory::createCacheFactory(cacheProps);
-  auto cachePtr = CacheFactory::createCacheFactory()->create();
+  auto cachePtr = std::make_shared<Cache>(
+    CacheFactory::createCacheFactory()->create());
   ASSERT(cachePtr != nullptr, "Expected cache to be NON-nullptr");
   auto regionFactory = cachePtr->createRegionFactory(LOCAL);
   regionFactory.setCachingEnabled(true);
@@ -466,7 +467,8 @@ END_TEST(OverFlowTest_absPath)
 BEGIN_TEST(OverFlowTest_SqLiteFull)
   {
     auto cacheFactoryPtr = CacheFactory::createCacheFactory();
-    auto cachePtr = CacheFactory::createCacheFactory()->create();
+    auto cachePtr = std::make_shared<Cache>(
+      CacheFactory::createCacheFactory()->create());
     ASSERT(cachePtr != nullptr, "Expected cache to be NON-nullptr");
     auto regionFactory = cachePtr->createRegionFactory(LOCAL);
     regionFactory.setCachingEnabled(true);
@@ -509,7 +511,8 @@ BEGIN_TEST(OverFlowTest_HeapLRU)
     pp->insert("heap-lru-limit", 1);
     pp->insert("heap-lru-delta", 10);
     auto cacheFactoryPtr = CacheFactory::createCacheFactory(pp);
-    auto cachePtr = CacheFactory::createCacheFactory()->create();
+    auto cachePtr = std::make_shared<Cache>(
+      CacheFactory::createCacheFactory()->create());
     ASSERT(cachePtr != nullptr, "Expected cache to be NON-nullptr");
     auto regionFactory = cachePtr->createRegionFactory(LOCAL);
     regionFactory.setCachingEnabled(true);
@@ -570,7 +573,8 @@ END_TEST(OverFlowTest_HeapLRU)
 BEGIN_TEST(OverFlowTest_MultiThreaded)
   {
     /** Creating a cache to manage regions. */
-    auto cachePtr = CacheFactory::createCacheFactory()->create();
+    auto cachePtr = std::make_shared<Cache>(
+      CacheFactory::createCacheFactory()->create());
     ASSERT(cachePtr != nullptr, "Expected cache to be NON-nullptr");
 
     std::shared_ptr<RegionAttributes> attrsPtr;
@@ -611,7 +615,8 @@ END_TEST(OverFlowTest_MultiThreaded)
 BEGIN_TEST(OverFlowTest_PutGetAll)
   {
     /** Creating a cache to manage regions. */
-    auto cachePtr = CacheFactory::createCacheFactory()->create();
+    auto cachePtr = std::make_shared<Cache>(
+      CacheFactory::createCacheFactory()->create());
     ASSERT(cachePtr != nullptr, "Expected cache to be NON-nullptr");
 
     std::shared_ptr<RegionAttributes> attrsPtr;
diff --git a/cppcache/integration-test/testPoolFactory.cpp b/cppcache/integration-test/testPoolFactory.cpp
index 6b9d89d..6b502d2 100644
--- a/cppcache/integration-test/testPoolFactory.cpp
+++ b/cppcache/integration-test/testPoolFactory.cpp
@@ -29,9 +29,8 @@ BEGIN_TEST(POOLFACTORY)
 {
   auto cacheFactory = CacheFactory::createCacheFactory();
   ASSERT(cacheFactory != nullptr, "CacheFactory was a nullptr");
-  auto cachePtr = cacheFactory->create();
-  ASSERT(cachePtr != nullptr, "CachePtr was a nullptr");
-  auto poolFactory = cachePtr->getPoolManager().createFactory();
+  auto cache = cacheFactory->create();
+  auto poolFactory = cache.getPoolManager().createFactory();
   ASSERT(poolFactory != nullptr, "poolFactory was a nullptr");
   auto& testPoolFactory = poolFactory->setSubscriptionEnabled(true);
   bool test = poolFactory.get() == std::addressof<PoolFactory>(testPoolFactory);
diff --git a/cppcache/integration-test/testRegionTemplateArgs.cpp b/cppcache/integration-test/testRegionTemplateArgs.cpp
index 18357e3..4ca2466 100644
--- a/cppcache/integration-test/testRegionTemplateArgs.cpp
+++ b/cppcache/integration-test/testRegionTemplateArgs.cpp
@@ -36,7 +36,7 @@ bool CheckBytesEqual(std::shared_ptr<CacheableBytes> result,
 BEGIN_TEST(CheckTemplates)
   {
     auto cacheFactoryPtr = CacheFactory::createCacheFactory();
-    auto cache = cacheFactoryPtr->create();
+    auto cache = std::make_shared<Cache>(cacheFactoryPtr->create());
     AttributesFactory afact;
     std::shared_ptr<RegionAttributes> attrs = afact.createRegionAttributes();
     std::shared_ptr<Region> regPtr;
diff --git a/cppcache/integration-test/testThinClientCqDurable.cpp b/cppcache/integration-test/testThinClientCqDurable.cpp
index f3718ad..c9c88e8 100644
--- a/cppcache/integration-test/testThinClientCqDurable.cpp
+++ b/cppcache/integration-test/testThinClientCqDurable.cpp
@@ -191,7 +191,7 @@ void RunDurableCqClient() {
 
   // Create a Geode Cache Programmatically.
   auto cacheFactory = CacheFactory::createCacheFactory(pp);
-  auto cachePtr = cacheFactory->create();
+  auto cachePtr = std::make_shared<Cache>(cacheFactory->create());
   auto poolFactory = cachePtr->getPoolManager().createFactory();
   poolFactory->setSubscriptionEnabled(true)
       .setSubscriptionAckInterval(std::chrono::milliseconds(5000))
@@ -253,7 +253,7 @@ void RunFeederClient() {
   auto cacheFactory = CacheFactory::createCacheFactory();
   LOGINFO("Feeder connected to the Geode Distributed System");
 
-  auto cachePtr = cacheFactory->create();
+  auto cachePtr = std::make_shared<Cache>(cacheFactory->create());
 
   LOGINFO("Created the Geode Cache");
 
@@ -285,7 +285,7 @@ void RunFeederClient1() {
   auto cacheFactory = CacheFactory::createCacheFactory();
   LOGINFO("Feeder connected to the Geode Distributed System");
 
-  auto cachePtr = cacheFactory->create();
+  auto cachePtr = std::make_shared<Cache>(cacheFactory->create());
 
   LOGINFO("Created the Geode Cache");
 
diff --git a/cppcache/integration-test/testXmlCacheCreationWithOverFlow.cpp b/cppcache/integration-test/testXmlCacheCreationWithOverFlow.cpp
index 54256de..94ee5da 100644
--- a/cppcache/integration-test/testXmlCacheCreationWithOverFlow.cpp
+++ b/cppcache/integration-test/testXmlCacheCreationWithOverFlow.cpp
@@ -51,7 +51,8 @@ int testXmlCacheCreationWithOverflow() {
 
   try {
     std::string filePath = directory + "/resources/non-existent.xml";
-    cptr = cacheFactory->set("cache-xml-file", filePath.c_str())->create();
+    cptr = std::make_shared<Cache>(
+      cacheFactory->set("cache-xml-file", filePath.c_str())->create());
     return -1;
   } catch (CacheXmlException& ex) {
     std::cout << "CacheXmlException: msg = " << ex.what() << std::endl;
@@ -65,7 +66,8 @@ int testXmlCacheCreationWithOverflow() {
   try {
     std::string filePath = directory + "/resources/valid_overflowAttr.xml";
     std::cout << "getPdxIgnoreUnreadFields should return true.1" << std::endl;
-    cptr = cacheFactory->set("cache-xml-file", filePath.c_str())->create();
+    cptr = std::make_shared<Cache>(
+      cacheFactory->set("cache-xml-file", filePath.c_str())->create());
     if (cptr->getPdxIgnoreUnreadFields() != false) {
       std::cout << "getPdxIgnoreUnreadFields should return true." << std::endl;
       return -1;
@@ -246,7 +248,8 @@ int testXmlCacheCreationWithOverflow() {
 
   try {
     std::string filePath = directory + "/invalid_overflowAttr1.xml";
-    cptr = cacheFactory->set("cache-xml-file", filePath.c_str())->create();
+    cptr = std::make_shared<Cache>(
+      cacheFactory->set("cache-xml-file", filePath.c_str())->create());
     return -1;
   } catch (Exception& ex) {
     std::cout << std::endl;
@@ -265,7 +268,8 @@ int testXmlCacheCreationWithOverflow() {
 
   try {
     std::string filePath = directory + "/invalid_overflowAttr2.xml";
-    cptr = cacheFactory->set("cache-xml-file", filePath.c_str())->create();
+    cptr = std::make_shared<Cache>(
+      cacheFactory->set("cache-xml-file", filePath.c_str())->create());
     return -1;
   } catch (CacheXmlException& ex) {
     std::cout << std::endl;
@@ -285,7 +289,8 @@ int testXmlCacheCreationWithOverflow() {
 
   try {
     std::string filePath = directory + "/invalid_overflowAttr3.xml";
-    cptr = cacheFactory->set("cache-xml-file", filePath.c_str())->create();
+    cptr = std::make_shared<Cache>(
+      cacheFactory->set("cache-xml-file", filePath.c_str())->create());
     return -1;
   } catch (Exception& ex) {
     std::cout << std::endl;
diff --git a/cppcache/integration-test/testXmlCacheCreationWithPools.cpp b/cppcache/integration-test/testXmlCacheCreationWithPools.cpp
index a09d843..2bed934 100644
--- a/cppcache/integration-test/testXmlCacheCreationWithPools.cpp
+++ b/cppcache/integration-test/testXmlCacheCreationWithPools.cpp
@@ -276,7 +276,8 @@ int testXmlCacheCreationWithPools() {
     std::string filePath = "valid_cache_pool.xml";
     std::string duplicateFile;
     CacheHelper::createDuplicateXMLFile(duplicateFile, filePath);
-    cptr = cacheFactory->set("cache-xml-file", duplicateFile.c_str())->create();
+    cptr = std::make_shared<Cache>(
+      cacheFactory->set("cache-xml-file", duplicateFile.c_str())->create());
     if (cptr->getPdxIgnoreUnreadFields() != true) {
       std::cout << "getPdxIgnoreUnreadFields should return true." << std::endl;
       return -1;
@@ -415,7 +416,8 @@ int testXmlCacheCreationWithPools() {
     std::string filePath = "invalid_cache_pool.xml";
     std::string duplicateFile;
     CacheHelper::createDuplicateXMLFile(duplicateFile, filePath);
-    cptr = cacheFactory->set("cache-xml-file", duplicateFile.c_str())->create();
+    cptr = std::make_shared<Cache>(
+      cacheFactory->set("cache-xml-file", duplicateFile.c_str())->create());
     return -1;
   } catch (Exception& ex) {
     std::cout << "EXPECTED EXCEPTION" << std::endl;
@@ -428,7 +430,8 @@ int testXmlCacheCreationWithPools() {
     std::string filePath = "invalid_cache_pool2.xml";
     std::string duplicateFile;
     CacheHelper::createDuplicateXMLFile(duplicateFile, filePath);
-    cptr = cacheFactory->set("cache-xml-file", duplicateFile.c_str())->create();
+    cptr = std::make_shared<Cache>(
+      cacheFactory->set("cache-xml-file", duplicateFile.c_str())->create());
     return -1;
   } catch (Exception& ex) {
     std::cout << "EXPECTED EXCEPTION" << std::endl;
@@ -441,7 +444,8 @@ int testXmlCacheCreationWithPools() {
     std::string filePath = "invalid_cache_pool3.xml";
     std::string duplicateFile;
     CacheHelper::createDuplicateXMLFile(duplicateFile, filePath);
-    cptr = cacheFactory->set("cache-xml-file", duplicateFile.c_str())->create();
+    cptr = std::make_shared<Cache>(
+      cacheFactory->set("cache-xml-file", duplicateFile.c_str())->create());
     return -1;
   } catch (Exception& ex) {
     std::cout << "EXPECTED EXCEPTION" << std::endl;
@@ -454,7 +458,8 @@ int testXmlCacheCreationWithPools() {
     std::string filePath = "invalid_cache_pool4.xml";
     std::string duplicateFile;
     CacheHelper::createDuplicateXMLFile(duplicateFile, filePath);
-    cptr = cacheFactory->set("cache-xml-file", duplicateFile.c_str())->create();
+    cptr = std::make_shared<Cache>(
+      cacheFactory->set("cache-xml-file", duplicateFile.c_str())->create());
     return -1;
   } catch (Exception& ex) {
     std::cout << "EXPECTED EXCEPTION" << std::endl;
@@ -495,7 +500,8 @@ int testXmlDeclarativeCacheCreation() {
   try {
     std::string filePath =
         directory + "/resources/valid_declarative_cache_creation.xml";
-    cptr = cacheFactory->set("cache-xml-file", filePath.c_str())->create();
+    cptr = std::make_shared<Cache>(
+      cacheFactory->set("cache-xml-file", filePath.c_str())->create());
 
   } catch (Exception& ex) {
     std::cout << "Exception: msg = " << ex.what() << std::endl;
diff --git a/cppcache/integration-test/testXmlCacheCreationWithRefid.cpp b/cppcache/integration-test/testXmlCacheCreationWithRefid.cpp
index 6d2fcc3..c2b4e5b 100644
--- a/cppcache/integration-test/testXmlCacheCreationWithRefid.cpp
+++ b/cppcache/integration-test/testXmlCacheCreationWithRefid.cpp
@@ -50,7 +50,8 @@ int testXmlCacheCreationWithRefid(const char* fileName) {
 
   try {
     std::string filePath = directory + fileName;
-    cptr = cacheFactory->set("cache-xml-file", filePath.c_str())->create();
+    cptr = std::make_shared<Cache>(
+      cacheFactory->set("cache-xml-file", filePath.c_str())->create());
     if (cptr->getPdxIgnoreUnreadFields() != false) {
       std::cout << "getPdxIgnoreUnreadFields should return false." << std::endl;
       return -1;
diff --git a/cppcache/src/Cache.cpp b/cppcache/src/Cache.cpp
index 40d2142..d10bf0e 100644
--- a/cppcache/src/Cache.cpp
+++ b/cppcache/src/Cache.cpp
@@ -122,27 +122,38 @@ std::vector<std::shared_ptr<Region>> Cache::rootRegions() {
 RegionFactory Cache::createRegionFactory(RegionShortcut preDefinedRegion) {
   return m_cacheImpl->createRegionFactory(preDefinedRegion);
 }
- std::shared_ptr<QueryService> Cache::getQueryService() {
-   return m_cacheImpl->getQueryService();
- }
- std::shared_ptr<QueryService> Cache::getQueryService(const char* poolName) {
-   return m_cacheImpl->getQueryService(poolName);
- }
- std::shared_ptr<CacheTransactionManager> Cache::getCacheTransactionManager() {
-   return m_cacheImpl->getCacheTransactionManager();
- }
 
- TypeRegistry& Cache::getTypeRegistry() { return *(m_typeRegistry.get()); }
+std::shared_ptr<QueryService> Cache::getQueryService() {
+  return m_cacheImpl->getQueryService();
+}
+
+std::shared_ptr<QueryService> Cache::getQueryService(const char* poolName) {
+  return m_cacheImpl->getQueryService(poolName);
+}
+
+std::shared_ptr<CacheTransactionManager> Cache::getCacheTransactionManager() {
+  return m_cacheImpl->getCacheTransactionManager();
+}
+
+TypeRegistry& Cache::getTypeRegistry() { return *(m_typeRegistry.get()); }
+
+Cache::Cache(const std::string& name, std::shared_ptr<Properties> dsProp,
+             bool ignorePdxUnreadFields, bool readPdxSerialized,
+             const std::shared_ptr<AuthInitialize>& authInitialize) {
+  m_cacheImpl = std::unique_ptr<CacheImpl>(
+      new CacheImpl(this, name,
+                    DistributedSystem::create(DEFAULT_DS_NAME, dsProp),
+                    ignorePdxUnreadFields, readPdxSerialized, authInitialize));
+  m_cacheImpl->getDistributedSystem().connect(this);
+  m_typeRegistry = std::unique_ptr<TypeRegistry>(
+      new TypeRegistry(m_cacheImpl.get()));
+}
+
+Cache::Cache(Cache&& other) noexcept :
+  m_cacheImpl(std::move(other.m_cacheImpl)),
+  m_typeRegistry(std::move(other.m_typeRegistry)) {
 
- Cache::Cache(const std::string& name, std::shared_ptr<Properties> dsProp,
-              bool ignorePdxUnreadFields, bool readPdxSerialized,
-              const std::shared_ptr<AuthInitialize>& authInitialize) {
-   auto dsPtr = DistributedSystem::create(DEFAULT_DS_NAME, this, dsProp);
-   dsPtr->connect();
-   m_cacheImpl = std::unique_ptr<CacheImpl>(
-       new CacheImpl(this, name, std::move(dsPtr), ignorePdxUnreadFields,
-                     readPdxSerialized, authInitialize));
-   m_typeRegistry = std::unique_ptr<TypeRegistry>(new TypeRegistry(*this));
+  m_cacheImpl->setCache(this);
 }
 
 Cache::~Cache() = default;
@@ -176,7 +187,7 @@ bool Cache::isPoolInMultiuserMode(std::shared_ptr<Region> regionPtr) {
   const char* poolName = regionPtr->getAttributes()->getPoolName();
 
   if (poolName != nullptr) {
-    auto poolPtr = regionPtr->getCache()->getPoolManager().find(poolName);
+    auto poolPtr = regionPtr->getCache().getPoolManager().find(poolName);
     if (poolPtr != nullptr && !poolPtr->isDestroyed()) {
       return poolPtr->getMultiuserAuthentication();
     }
diff --git a/cppcache/src/CacheFactory.cpp b/cppcache/src/CacheFactory.cpp
index abe0058..1d0d2f9 100644
--- a/cppcache/src/CacheFactory.cpp
+++ b/cppcache/src/CacheFactory.cpp
@@ -55,20 +55,6 @@ std::shared_ptr<CacheFactory> CacheFactory::createCacheFactory(
   return std::make_shared<CacheFactory>(configPtr);
 }
 
-void CacheFactory::create_(const char* name, const char* id_data,
-                           std::shared_ptr<Cache>& cptr, bool readPdxSerialized) {
-  cptr = nullptr;
-  if (name == nullptr) {
-    throw IllegalArgumentException("CacheFactory::create: name is nullptr");
-  }
-  if (name[0] == '\0') {
-    name = "NativeCache";
-  }
-
-  cptr = std::make_shared<Cache>(name, dsProp, ignorePdxUnreadFields,
-                                 readPdxSerialized, authInitialize);
-}  // namespace client
-
 const char* CacheFactory::getVersion() { return PRODUCT_VERSION; }
 
 const char* CacheFactory::getProductDescription() {
@@ -87,76 +73,83 @@ CacheFactory::CacheFactory(const std::shared_ptr<Properties> dsProps) {
   pdxReadSerialized = false;
   this->dsProp = dsProps;
 }
- std::shared_ptr<Cache> CacheFactory::create() {
-   ACE_Guard<ACE_Recursive_Thread_Mutex> connectGuard(*g_disconnectLock);
 
-   LOGFINE("CacheFactory called DistributedSystem::connect");
-   auto cache = create(DEFAULT_CACHE_NAME, nullptr);
+Cache CacheFactory::create() {
+  ACE_Guard<ACE_Recursive_Thread_Mutex> connectGuard(*g_disconnectLock);
 
-   auto& cacheImpl = cache->m_cacheImpl;
-   const auto& serializationRegistry = cacheImpl->getSerializationRegistry();
-   const auto& pdxTypeRegistry = cacheImpl->getPdxTypeRegistry();
-   const auto& memberListForVersionStamp =
-       std::ref(*(cacheImpl->getMemberListForVersionStamp()));
+  LOGFINE("CacheFactory called DistributedSystem::connect");
+  auto cache = create(DEFAULT_CACHE_NAME, nullptr);
 
-   serializationRegistry->addType2(
-       std::bind(TXCommitMessage::create, memberListForVersionStamp));
+  auto& cacheImpl = cache.m_cacheImpl;
+  const auto& serializationRegistry = cacheImpl->getSerializationRegistry();
+  const auto& pdxTypeRegistry = cacheImpl->getPdxTypeRegistry();
+  const auto& memberListForVersionStamp =
+      std::ref(*(cacheImpl->getMemberListForVersionStamp()));
 
-   serializationRegistry->addType(
-       GeodeTypeIds::PdxType,
-       std::bind(PdxType::CreateDeserializable, pdxTypeRegistry));
+  serializationRegistry->addType2(
+      std::bind(TXCommitMessage::create, memberListForVersionStamp));
 
-   serializationRegistry->addType(
-       std::bind(VersionTag::createDeserializable, memberListForVersionStamp));
+  serializationRegistry->addType(
+      GeodeTypeIds::PdxType,
+      std::bind(PdxType::CreateDeserializable, pdxTypeRegistry));
 
-   serializationRegistry->addType2(
-       GeodeTypeIdsImpl::DiskVersionTag,
-       std::bind(DiskVersionTag::createDeserializable,
-                 memberListForVersionStamp));
+  serializationRegistry->addType(
+      std::bind(VersionTag::createDeserializable, memberListForVersionStamp));
 
-   serializationRegistry->setPdxTypeHandler([](DataInput& dataInput) {
-     return PdxHelper::deserializePdx(dataInput, false);
-   });
+  serializationRegistry->addType2(
+      GeodeTypeIdsImpl::DiskVersionTag,
+      std::bind(DiskVersionTag::createDeserializable,
+                memberListForVersionStamp));
 
-   pdxTypeRegistry->setPdxIgnoreUnreadFields(cache->getPdxIgnoreUnreadFields());
-   pdxTypeRegistry->setPdxReadSerialized(cache->getPdxReadSerialized());
+  serializationRegistry->setPdxTypeHandler([](DataInput& dataInput) {
+    return PdxHelper::deserializePdx(dataInput, false);
+  });
 
-   return cache;
+  pdxTypeRegistry->setPdxIgnoreUnreadFields(cache.getPdxIgnoreUnreadFields());
+  pdxTypeRegistry->setPdxReadSerialized(cache.getPdxReadSerialized());
+
+  return cache;
 }
-std::shared_ptr<Cache> CacheFactory::create(
+
+Cache CacheFactory::create(
     const char* name,
     const std::shared_ptr<CacheAttributes>& attrs /*= nullptr*/) {
   ACE_Guard<ACE_Recursive_Thread_Mutex> connectGuard(*g_disconnectLock);
 
-  std::shared_ptr<Cache> cptr;
-  create_(name, "", cptr, pdxReadSerialized);
-  cptr->m_cacheImpl->setAttributes(attrs);
+  if (name == nullptr) {
+    throw IllegalArgumentException("CacheFactory::create: name is nullptr");
+  }
+  if (name[0] == '\0') {
+    name = "NativeCache";
+  }
+
+  auto cache = Cache(name, dsProp, ignorePdxUnreadFields,
+                    pdxReadSerialized, authInitialize);
+  cache.m_cacheImpl->setAttributes(attrs);
   try {
-    const char* cacheXml =
-        cptr->getDistributedSystem().getSystemProperties().cacheXMLFile();
+    const auto cacheXml =
+        cache.getDistributedSystem().getSystemProperties().cacheXMLFile();
     if (cacheXml != 0 && strlen(cacheXml) > 0) {
-      cptr->initializeDeclarativeCache(cacheXml);
+      cache.initializeDeclarativeCache(cacheXml);
     } else {
-      cptr->m_cacheImpl->initServices();
+      cache.m_cacheImpl->initServices();
     }
   } catch (const apache::geode::client::RegionExistsException&) {
     LOGWARN("Attempt to create existing regions declaratively");
   } catch (const apache::geode::client::Exception&) {
-    if (!cptr->isClosed()) {
-      cptr->close();
-      cptr = nullptr;
+    if (!cache.isClosed()) {
+      cache.close();
     }
     throw;
   } catch (...) {
-    if (!cptr->isClosed()) {
-      cptr->close();
-      cptr = nullptr;
+    if (!cache.isClosed()) {
+      cache.close();
     }
     throw apache::geode::client::UnknownException(
         "Exception thrown in CacheFactory::create");
   }
 
-  return cptr;
+  return cache;
 }
 
 CacheFactory::~CacheFactory() {}
diff --git a/cppcache/src/CacheImpl.cpp b/cppcache/src/CacheImpl.cpp
index dabf356..1732f5c 100644
--- a/cppcache/src/CacheImpl.cpp
+++ b/cppcache/src/CacheImpl.cpp
@@ -57,7 +57,7 @@ CacheImpl::CacheImpl(Cache* c, const std::string& name,
       m_closed(false),
       m_initialized(false),
       m_distributedSystem(std::move(sys)),
-      m_implementee(c),
+      m_cache(c),
       m_cond(m_mutex),
       m_attributes(nullptr),
       m_evictionControllerPtr(nullptr),
@@ -69,7 +69,7 @@ CacheImpl::CacheImpl(Cache* c, const std::string& name,
       m_memberListForVersionStamp(
           *(std::make_shared<MemberListForVersionStamp>())),
       m_serializationRegistry(std::make_shared<SerializationRegistry>()),
-      m_pdxTypeRegistry(std::make_shared<PdxTypeRegistry>(c)),
+      m_pdxTypeRegistry(nullptr),
       m_expiryTaskManager(
           std::unique_ptr<ExpiryTaskManager>(new ExpiryTaskManager())),
       m_clientProxyMembershipIDFactory(m_distributedSystem->getName()),
@@ -77,7 +77,7 @@ CacheImpl::CacheImpl(Cache* c, const std::string& name,
           m_distributedSystem->getSystemProperties().threadPoolSize())),
       m_authInitialize(authInitialize) {
   m_cacheTXManager = std::shared_ptr<InternalCacheTransactionManager2PC>(
-      new InternalCacheTransactionManager2PCImpl(c));
+      new InternalCacheTransactionManager2PCImpl(this));
 
   m_regions = new MapOfRegionWithLock();
   auto& prop = m_distributedSystem->getSystemProperties();
@@ -88,14 +88,11 @@ CacheImpl::CacheImpl(Cache* c, const std::string& name,
     LOGINFO("Heap LRU eviction controller thread started");
   }
 
-  m_cacheStats = new CachePerfStats(m_distributedSystem.get()
-                                        ->getStatisticsManager()
-                                        ->getStatisticsFactory());
   m_expiryTaskManager->begin();
 
   m_initialized = true;
-
-  m_poolManager = std::unique_ptr<PoolManager>(new PoolManager(*m_implementee));
+  m_pdxTypeRegistry = std::make_shared<PdxTypeRegistry>(this);
+  m_poolManager = std::unique_ptr<PoolManager>(new PoolManager(this));
 }
 
 void CacheImpl::initServices() {
@@ -381,7 +378,7 @@ void CacheImpl::createRegion(const char* name,
   }
 
   validateRegionAttributes(name, aRegionAttributes);
-std::shared_ptr<RegionInternal> rpImpl = nullptr;
+  std::shared_ptr<RegionInternal> rpImpl = nullptr;
   {
     // For multi threading and the operations between bind and find seems to be
     // hard to be atomic since a regionImpl needs to be valid before it can be
@@ -546,7 +543,7 @@ std::shared_ptr<RegionInternal> CacheImpl::createRegion_internal(
         "RegionAttributes is null");
   }
 
-std::shared_ptr<RegionInternal> rptr = nullptr;
+  std::shared_ptr<RegionInternal> rptr = nullptr;
   RegionKind regionKind = getRegionKind(attrs);
   const char* poolName = attrs->getPoolName();
   const char* regionEndpoints = attrs->getEndpoints();
@@ -797,3 +794,7 @@ CacheImpl::getCacheTransactionManager() {
           new MemberListForVersionStamp());
   return *versionStampMemIdList;
 }
+
+void CacheImpl::setCache(Cache* cache) {
+  m_cache = cache;
+}
diff --git a/cppcache/src/CacheImpl.hpp b/cppcache/src/CacheImpl.hpp
index 614d98c..97eb881 100644
--- a/cppcache/src/CacheImpl.hpp
+++ b/cppcache/src/CacheImpl.hpp
@@ -226,7 +226,7 @@ class CPPCACHE_EXPORT CacheImpl : private NonCopyable, private NonAssignable {
     return m_clientProxyMembershipIDFactory;
   }
 
-  Cache* getCache() const { return m_implementee; }
+  Cache* getCache() const { return m_cache; }
   TcrConnectionManager& tcrConnectionManager() {
     return *m_tcrConnectionManager;
   }
@@ -321,6 +321,9 @@ class CPPCACHE_EXPORT CacheImpl : private NonCopyable, private NonAssignable {
       srm.bind((*p).ext_id_, (*p).int_id_);
     }
   }
+
+  void setCache(Cache* cache);
+
   std::string m_name;
   bool m_closed;
   bool m_initialized;
@@ -328,7 +331,7 @@ class CPPCACHE_EXPORT CacheImpl : private NonCopyable, private NonAssignable {
   std::unique_ptr<DistributedSystem> m_distributedSystem;
   ClientProxyMembershipIDFactory m_clientProxyMembershipIDFactory;
   MapOfRegionWithLock* m_regions;
-  Cache* m_implementee;
+  Cache* m_cache;
   ACE_Recursive_Thread_Mutex m_mutex;
   Condition m_cond;
   std::shared_ptr<CacheAttributes> m_attributes;
@@ -350,6 +353,7 @@ class CPPCACHE_EXPORT CacheImpl : private NonCopyable, private NonAssignable {
 
   friend class CacheFactory;
   friend class Cache;
+  friend class DistributedSystem;
 };
 }  // namespace client
 }  // namespace geode
diff --git a/cppcache/src/CacheTransactionManagerImpl.cpp b/cppcache/src/CacheTransactionManagerImpl.cpp
index 42ef64f..ff201b4 100644
--- a/cppcache/src/CacheTransactionManagerImpl.cpp
+++ b/cppcache/src/CacheTransactionManagerImpl.cpp
@@ -39,7 +39,7 @@ namespace apache {
 namespace geode {
 namespace client {
 
-CacheTransactionManagerImpl::CacheTransactionManagerImpl(Cache* cache)
+CacheTransactionManagerImpl::CacheTransactionManagerImpl(CacheImpl* cache)
     : m_cache(cache), m_txCond(m_suspendedTxLock) {}
 
 CacheTransactionManagerImpl::~CacheTransactionManagerImpl() {}
@@ -49,7 +49,7 @@ void CacheTransactionManagerImpl::begin() {
     GfErrTypeThrowException("Transaction already in progress",
                             GF_CACHE_ILLEGAL_STATE_EXCEPTION);
   }
-  TXState* txState = new TXState(m_cache);
+  TXState* txState = new TXState(m_cache->getCache());
   TSSTXStateWrapper::s_geodeTSSTXState->setTXState(txState);
   addTx(txState->getTransactionId()->getId());
 }
@@ -64,7 +64,7 @@ void CacheTransactionManagerImpl::commit() {
         GF_CACHE_ILLEGAL_STATE_EXCEPTION);
   }
 
-  TcrMessageCommit request(m_cache->createDataOutput());
+  TcrMessageCommit request(m_cache->getCache()->createDataOutput());
   TcrMessageReply reply(true, nullptr);
 
   ThinClientPoolDM* tcr_dm = getDM();
@@ -114,7 +114,7 @@ void CacheTransactionManagerImpl::commit() {
 
   auto commit = std::static_pointer_cast<TXCommitMessage>(reply.getValue());
   txCleaner.clean();
-  commit->apply(m_cache);
+  commit->apply(m_cache->getCache());
 
   /*
           if(m_writer != nullptr)
@@ -276,7 +276,7 @@ void CacheTransactionManagerImpl::rollback() {
 
 GfErrType CacheTransactionManagerImpl::rollback(TXState* txState,
                                                 bool callListener) {
-  TcrMessageRollback request(m_cache->createDataOutput());
+  TcrMessageRollback request(m_cache->getCache()->createDataOutput());
   TcrMessageReply reply(true, nullptr);
   GfErrType err = GF_NOERR;
   ThinClientPoolDM* tcr_dm = getDM();
@@ -325,7 +325,7 @@ ThinClientPoolDM* CacheTransactionManagerImpl::getDM() {
   return nullptr;
 }
 
-Cache* CacheTransactionManagerImpl::getCache() { return m_cache; }
+Cache* CacheTransactionManagerImpl::getCache() { return m_cache->getCache(); }
 std::shared_ptr<TransactionId> CacheTransactionManagerImpl::suspend() {
   // get the current state of the thread
   TXState* txState = TSSTXStateWrapper::s_geodeTSSTXState->getTXState();
@@ -363,9 +363,8 @@ std::shared_ptr<TransactionId> CacheTransactionManagerImpl::suspend() {
                                 .suspendedTxTimeout();
   auto handler = new SuspendedTxExpiryHandler(this, txState->getTransactionId(),
                                               suspendedTxTimeout);
-  long id = CacheRegionHelper::getCacheImpl(m_cache)
-                ->getExpiryTaskManager()
-                .scheduleExpiryTask(handler, suspendedTxTimeout,
+  long id = m_cache->getExpiryTaskManager()
+                   .scheduleExpiryTask(handler, suspendedTxTimeout,
                                     std::chrono::seconds::zero(), false);
   txState->setSuspendedExpiryTaskId(id);
 
@@ -452,10 +451,10 @@ void CacheTransactionManagerImpl::resumeTxUsingTxState(TXState* txState,
 
   if (cancelExpiryTask) {
     // cancel the expiry task for the transaction
-    CacheRegionHelper::getCacheImpl(m_cache)->getExpiryTaskManager().cancelTask(
+    m_cache->getExpiryTaskManager().cancelTask(
         txState->getSuspendedExpiryTaskId());
   } else {
-    CacheRegionHelper::getCacheImpl(m_cache)->getExpiryTaskManager().resetTask(
+    m_cache->getExpiryTaskManager().resetTask(
         txState->getSuspendedExpiryTaskId(), std::chrono::seconds(0));
   }
 
diff --git a/cppcache/src/CacheTransactionManagerImpl.hpp b/cppcache/src/CacheTransactionManagerImpl.hpp
index 098f704..9eec27b 100644
--- a/cppcache/src/CacheTransactionManagerImpl.hpp
+++ b/cppcache/src/CacheTransactionManagerImpl.hpp
@@ -36,7 +36,7 @@ enum commitOp { BEFORE_COMMIT, AFTER_COMMIT };
 class CacheTransactionManagerImpl
     : public virtual apache::geode::client::CacheTransactionManager {
  public:
-  CacheTransactionManagerImpl(Cache* cache);
+  CacheTransactionManagerImpl(CacheImpl* cache);
   virtual ~CacheTransactionManagerImpl();
 
   virtual void begin() override;
@@ -63,7 +63,7 @@ class CacheTransactionManagerImpl
   Cache* getCache();
 
  private:
-  Cache* m_cache;
+  CacheImpl* m_cache;
 
   void resumeTxUsingTxState(TXState* txState, bool cancelExpiryTask = true);
   GfErrType rollback(TXState* txState, bool callListener);
diff --git a/cppcache/src/DistributedSystem.cpp b/cppcache/src/DistributedSystem.cpp
index 02f398d..a3824b0 100644
--- a/cppcache/src/DistributedSystem.cpp
+++ b/cppcache/src/DistributedSystem.cpp
@@ -27,17 +27,18 @@
 #include <geode/CacheFactory.hpp>
 #include <ace/OS.h>
 
-#include <ExpiryTaskManager.hpp>
-#include <CacheImpl.hpp>
 #include <ace/Guard_T.h>
 #include <ace/Recursive_Thread_Mutex.h>
-#include <geode/DataOutput.hpp>
-#include <TcrMessage.hpp>
-#include <DistributedSystemImpl.hpp>
-#include <RegionStats.hpp>
-#include <PoolStatistics.hpp>
 
-#include <DiffieHellman.hpp>
+#include "ExpiryTaskManager.hpp"
+#include "CacheImpl.hpp"
+#include "geode/DataOutput.hpp"
+#include "TcrMessage.hpp"
+#include "DistributedSystemImpl.hpp"
+#include "RegionStats.hpp"
+#include "PoolStatistics.hpp"
+#include "CacheRegionHelper.hpp"
+#include "DiffieHellman.hpp"
 
 #include "version.h"
 
@@ -101,10 +102,10 @@ void setLFH() {
 }  // namespace apache
 
 DistributedSystem::DistributedSystem(
-    const std::string& name, std::unique_ptr<StatisticsManager> statMngr,
+    const std::string& name,
     std::unique_ptr<SystemProperties> sysProps)
     : m_name(name),
-      m_statisticsManager(std::move(statMngr)),
+      m_statisticsManager(nullptr),
       m_sysProps(std::move(sysProps)),
       m_connected(false) {
   LOGDEBUG("DistributedSystem::DistributedSystem");
@@ -150,8 +151,7 @@ void DistributedSystem::logSystemInformation() {
 }
 
 std::unique_ptr<DistributedSystem> DistributedSystem::create(
-    const std::string& _name, Cache* cache,
-    const std::shared_ptr<Properties>& configPtr) {
+    const std::string& _name, const std::shared_ptr<Properties>& configPtr) {
   // TODO global - Refactory out the static initialization
   // Trigger other library initialization.
   CppCacheLibrary::initLib();
@@ -195,21 +195,8 @@ std::unique_ptr<DistributedSystem> DistributedSystem::create(
     throw;
   }
 
-  std::unique_ptr<StatisticsManager> statMngr;
-  try {
-    statMngr = std::unique_ptr<StatisticsManager>(new StatisticsManager(
-        sysProps->statisticsArchiveFile(), sysProps->statisticsSampleInterval(),
-        sysProps->statisticsEnabled(), cache, sysProps->durableClientId(),
-        sysProps->durableTimeout(), sysProps->statsFileSizeLimit(),
-        sysProps->statsDiskSpaceLimit()));
-  } catch (const NullPointerException&) {
-    Log::close();
-    throw;
-  }
-  GF_D_ASSERT(m_statisticsManager != nullptr);
-
   auto distributedSystem = std::unique_ptr<DistributedSystem>(
-      new DistributedSystem(name, std::move(statMngr), std::move(sysProps)));
+      new DistributedSystem(name,  std::move(sysProps)));
   if (!distributedSystem) {
     throw NullPointerException("DistributedSystem::connect: new failed");
   }
@@ -221,7 +208,7 @@ std::unique_ptr<DistributedSystem> DistributedSystem::create(
   return distributedSystem;
 }
 
-void DistributedSystem::connect() {
+void DistributedSystem::connect(Cache* cache) {
   ACE_Guard<ACE_Recursive_Thread_Mutex> disconnectGuard(*g_disconnectLock);
   if (m_connected == true) {
     throw AlreadyConnectedException(
@@ -248,6 +235,20 @@ void DistributedSystem::connect() {
         "DistributedSystem::connect: caught unknown exception");
   }
 
+  auto cacheImpl = CacheRegionHelper::getCacheImpl(cache);
+  try {
+    m_statisticsManager = std::unique_ptr<StatisticsManager>(new StatisticsManager(
+        m_sysProps->statisticsArchiveFile(), m_sysProps->statisticsSampleInterval(),
+        m_sysProps->statisticsEnabled(), cacheImpl,
+        m_sysProps->durableClientId(), m_sysProps->durableTimeout(),
+        m_sysProps->statsFileSizeLimit(), m_sysProps->statsDiskSpaceLimit()));
+    cacheImpl->m_cacheStats = new CachePerfStats(getStatisticsManager()->getStatisticsFactory());
+  }
+  catch (const NullPointerException&) {
+    Log::close();
+    throw;
+  }
+
   m_connected = true;
 }
 
diff --git a/cppcache/src/FunctionService.cpp b/cppcache/src/FunctionService.cpp
index fce4969..f4cc345 100644
--- a/cppcache/src/FunctionService.cpp
+++ b/cppcache/src/FunctionService.cpp
@@ -49,7 +49,7 @@ std::shared_ptr<Execution> FunctionService::onRegion(
       // it is in multiuser mode
       proxyCache = pr->m_proxyCache;
       auto userAttachedPool = proxyCache->m_userAttributes->getPool();
-      auto pool = realRegion->getCache()->getPoolManager().find(
+      auto pool = realRegion->getCache().getPoolManager().find(
           userAttachedPool->getName());
       if (!(pool != nullptr && pool.get() == userAttachedPool.get() &&
             !pool->isDestroyed())) {
@@ -57,8 +57,8 @@ std::shared_ptr<Execution> FunctionService::onRegion(
             "Pool has been closed with attached Logical Cache.");
       }
       // getting real region to execute function on region
-      if (!realRegion->getCache()->isClosed()) {
-        realRegion->getCache()->m_cacheImpl->getRegion(realRegion->getName(),
+      if (!realRegion->getCache().isClosed()) {
+        realRegion->getCache().m_cacheImpl->getRegion(realRegion->getName(),
                                                        realRegion);
       } else {
         throw IllegalStateException("Cache has been closed");
diff --git a/cppcache/src/InternalCacheTransactionManager2PCImpl.cpp b/cppcache/src/InternalCacheTransactionManager2PCImpl.cpp
index 3d4b9ab..b46c16f 100644
--- a/cppcache/src/InternalCacheTransactionManager2PCImpl.cpp
+++ b/cppcache/src/InternalCacheTransactionManager2PCImpl.cpp
@@ -36,7 +36,7 @@ namespace geode {
 namespace client {
 
 InternalCacheTransactionManager2PCImpl::InternalCacheTransactionManager2PCImpl(
-    Cache* cache)
+    CacheImpl* cache)
     : CacheTransactionManagerImpl(cache) {}
 
 InternalCacheTransactionManager2PCImpl::
diff --git a/cppcache/src/InternalCacheTransactionManager2PCImpl.hpp b/cppcache/src/InternalCacheTransactionManager2PCImpl.hpp
index 34fcbb5..732154a 100644
--- a/cppcache/src/InternalCacheTransactionManager2PCImpl.hpp
+++ b/cppcache/src/InternalCacheTransactionManager2PCImpl.hpp
@@ -31,7 +31,7 @@ class InternalCacheTransactionManager2PCImpl
     : public apache::geode::client::CacheTransactionManagerImpl,
       public apache::geode::client::InternalCacheTransactionManager2PC {
  public:
-  InternalCacheTransactionManager2PCImpl(Cache* cache);
+  InternalCacheTransactionManager2PCImpl(CacheImpl* cache);
   virtual ~InternalCacheTransactionManager2PCImpl();
 
   virtual void prepare() override;
diff --git a/cppcache/src/LocalRegion.cpp b/cppcache/src/LocalRegion.cpp
index 30457bd..5aa9c4e 100644
--- a/cppcache/src/LocalRegion.cpp
+++ b/cppcache/src/LocalRegion.cpp
@@ -45,7 +45,7 @@ LocalRegion::LocalRegion(const std::string& name, CacheImpl* cache,
                          const std::shared_ptr<RegionAttributes>& attributes,
                          const std::shared_ptr<CacheStatistics>& stats,
                          bool shared, bool enableTimeStatistics)
-    : RegionInternal(cache->getCache()->shared_from_this(), attributes),
+    : RegionInternal(cache->getCache(), attributes),
       m_name(name),
       m_parentRegion(rPtr),
       m_cacheImpl(cache),
diff --git a/cppcache/src/PdxTypeRegistry.cpp b/cppcache/src/PdxTypeRegistry.cpp
index 9ce60b4..f4643a6 100644
--- a/cppcache/src/PdxTypeRegistry.cpp
+++ b/cppcache/src/PdxTypeRegistry.cpp
@@ -20,12 +20,13 @@
 #include "PdxTypeRegistry.hpp"
 #include "CacheRegionHelper.hpp"
 #include "ThinClientPoolDM.hpp"
+#include "CacheImpl.hpp"
 
 namespace apache {
 namespace geode {
 namespace client {
 
-PdxTypeRegistry::PdxTypeRegistry(Cache* cache)
+PdxTypeRegistry::PdxTypeRegistry(CacheImpl* cache)
     : cache(cache),
       typeIdToPdxType(),
       remoteTypeIdToMergedPdxType(),
@@ -54,10 +55,8 @@ int32_t PdxTypeRegistry::getPDXIdForType(const char* type, const char* poolname,
     }
   }
 
-  int typeId =
-      CacheRegionHelper::getCacheImpl(cache)
-          ->getSerializationRegistry()
-          ->GetPDXIdForType(cache->getPoolManager().find(poolname), nType);
+  int typeId = cache->getSerializationRegistry()
+                    ->GetPDXIdForType(cache->getPoolManager().find(poolname), nType);
   nType->setTypeId(typeId);
 
   PdxTypeRegistry::addPdxType(typeId, nType);
@@ -88,9 +87,8 @@ int32_t PdxTypeRegistry::getPDXIdForType(std::shared_ptr<PdxType> nType,
     }
   }
 
-  typeId = CacheRegionHelper::getCacheImpl(cache)
-               ->getSerializationRegistry()
-               ->GetPDXIdForType(cache->getPoolManager().find(poolname), nType);
+  typeId = cache->getSerializationRegistry()
+                ->GetPDXIdForType(cache->getPoolManager().find(poolname), nType);
   nType->setTypeId(typeId);
   pdxTypeToTypeIdMap.insert(std::make_pair(nType, typeId));
   addPdxType(typeId, nType);
@@ -273,7 +271,7 @@ std::shared_ptr<EnumInfo> PdxTypeRegistry::getEnum(int32_t enumVal) {
   ret = std::static_pointer_cast<EnumInfo>(
       static_cast<ThinClientPoolDM*>(
           cache->getPoolManager().getAll().begin()->second.get())
-          ->GetEnum(enumVal));
+               ->GetEnum(enumVal));
   tmp = intToEnum;
   (*tmp)[enumValPtr] = ret;
   intToEnum = tmp;
diff --git a/cppcache/src/PdxTypeRegistry.hpp b/cppcache/src/PdxTypeRegistry.hpp
index 9854991..f4f075d 100644
--- a/cppcache/src/PdxTypeRegistry.hpp
+++ b/cppcache/src/PdxTypeRegistry.hpp
@@ -63,7 +63,7 @@ typedef std::map<std::shared_ptr<PdxType>, int32_t, PdxTypeLessThan>
 class CPPCACHE_EXPORT PdxTypeRegistry
     : public std::enable_shared_from_this<PdxTypeRegistry> {
  private:
-  Cache* cache;
+  CacheImpl* cache;
 
   TypeIdVsPdxType typeIdToPdxType;
 
@@ -89,7 +89,7 @@ class CPPCACHE_EXPORT PdxTypeRegistry
   std::shared_ptr<CacheableHashMap> intToEnum;
 
  public:
-  PdxTypeRegistry(Cache* cache);
+  PdxTypeRegistry(CacheImpl* cache);
   PdxTypeRegistry(const PdxTypeRegistry& other) = delete;
 
   virtual ~PdxTypeRegistry();
diff --git a/cppcache/src/PoolManager.cpp b/cppcache/src/PoolManager.cpp
index f456be3..66469b7 100644
--- a/cppcache/src/PoolManager.cpp
+++ b/cppcache/src/PoolManager.cpp
@@ -18,11 +18,14 @@
 
 #include <geode/PoolManager.hpp>
 
+#include "CacheRegionHelper.hpp"
+#include "CacheImpl.hpp"
+
 using namespace apache::geode::client;
 
 class PoolManager::Impl {
  public:
-  Impl(const Cache& cache) : m_cache(cache) {}
+  Impl(CacheImpl* cache) : m_cache(cache) {}
   void removePool(const char* name);
 
   std::shared_ptr<PoolFactory> createFactory();
@@ -43,15 +46,16 @@ class PoolManager::Impl {
   HashMapOfPools m_connectionPools;
   std::recursive_mutex m_connectionPoolsLock;
   std::shared_ptr<Pool> m_defaultPool;
-  const Cache& m_cache;
+  CacheImpl* m_cache;
 };
 
 void PoolManager::Impl::removePool(const char* name) {
   std::lock_guard<std::recursive_mutex> guard(m_connectionPoolsLock);
   m_connectionPools.erase(name);
 }
+
 std::shared_ptr<PoolFactory> PoolManager::Impl::createFactory() {
-  return std::shared_ptr<PoolFactory>(new PoolFactory(m_cache));
+  return std::shared_ptr<PoolFactory>(new PoolFactory(*m_cache->getCache()));
 }
 
 void PoolManager::Impl::close(bool keepAlive) {
@@ -106,7 +110,7 @@ std::shared_ptr<Pool> PoolManager::Impl::getDefaultPool() {
   return m_defaultPool;
 }
 
-PoolManager::PoolManager(const Cache& cache)
+PoolManager::PoolManager(CacheImpl* cache)
     : m_pimpl(new Impl(cache), [](Impl* impl) { delete impl; }) {}
 
 void PoolManager::removePool(const char* name) { m_pimpl->removePool(name); }
diff --git a/cppcache/src/ProxyRegion.hpp b/cppcache/src/ProxyRegion.hpp
index 805e449..a9bf844 100644
--- a/cppcache/src/ProxyRegion.hpp
+++ b/cppcache/src/ProxyRegion.hpp
@@ -603,7 +603,7 @@ class CPPCACHE_EXPORT ProxyRegion : public Region {
 
   ProxyRegion(const std::shared_ptr<ProxyCache>& proxyCache,
               const std::shared_ptr<RegionInternal>& realRegion)
-      : Region(realRegion->getCache()) {
+      : Region(&realRegion->getCache()) {
     m_proxyCache = proxyCache;
     m_realRegion = realRegion;
   }
diff --git a/cppcache/src/Region.cpp b/cppcache/src/Region.cpp
index 0bf97dd..f834efb 100644
--- a/cppcache/src/Region.cpp
+++ b/cppcache/src/Region.cpp
@@ -20,7 +20,7 @@
 namespace apache {
 namespace geode {
 namespace client {
-Region::Region(const std::shared_ptr<Cache>& cache) : m_cache(cache) {}
+Region::Region(Cache* cache) : m_cache(cache) {}
 Region::~Region() {}
 }  // namespace client
 }  // namespace geode
diff --git a/cppcache/src/RegionInternal.cpp b/cppcache/src/RegionInternal.cpp
index 5775a6a..008917b 100644
--- a/cppcache/src/RegionInternal.cpp
+++ b/cppcache/src/RegionInternal.cpp
@@ -39,7 +39,7 @@ const CacheEventFlags CacheEventFlags::NOCACHEWRITER(
     CacheEventFlags::GF_NOCACHEWRITER);
 
 RegionInternal::RegionInternal(
-    const std::shared_ptr<Cache>& cache,
+    Cache* cache,
     const std::shared_ptr<RegionAttributes>& attributes)
     : Region(cache), m_regionAttributes(attributes) {}
 
diff --git a/cppcache/src/RegionInternal.hpp b/cppcache/src/RegionInternal.hpp
index 1edf9e8..cabc786 100644
--- a/cppcache/src/RegionInternal.hpp
+++ b/cppcache/src/RegionInternal.hpp
@@ -288,7 +288,7 @@ class RegionInternal : public Region {
   /**
    * @brief constructor
    */
-  RegionInternal(const std::shared_ptr<Cache>& cache, const std::shared_ptr<RegionAttributes>& attributes);
+  RegionInternal(Cache* cache, const std::shared_ptr<RegionAttributes>& attributes);
 
   void setLruEntriesLimit(uint32_t limit);
   void setRegionTimeToLiveExpirationAction(ExpirationAction::Action action);
diff --git a/cppcache/src/ThinClientPoolDM.cpp b/cppcache/src/ThinClientPoolDM.cpp
index 1fd6105..c6dffb1 100644
--- a/cppcache/src/ThinClientPoolDM.cpp
+++ b/cppcache/src/ThinClientPoolDM.cpp
@@ -83,7 +83,7 @@ class GetAllWork : public PooledWork<GfErrType>,
         m_keys(keys),
         m_region(region),
         m_aCallbackArgument(aCallbackArgument) {
-    m_request = new TcrMessageGetAll(region->getCache()->createDataOutput(),
+    m_request = new TcrMessageGetAll(region->getCache().createDataOutput(),
                                      region.get(), m_keys.get(), m_poolDM,
                                      m_aCallbackArgument);
     m_reply = new TcrMessageReply(true, m_poolDM);
diff --git a/cppcache/src/ThinClientPoolRegion.cpp b/cppcache/src/ThinClientPoolRegion.cpp
index afbcf32..814452b 100644
--- a/cppcache/src/ThinClientPoolRegion.cpp
+++ b/cppcache/src/ThinClientPoolRegion.cpp
@@ -42,7 +42,7 @@ void ThinClientPoolRegion::initTCR() {
   try {
     ThinClientPoolDM* poolDM = dynamic_cast<ThinClientPoolDM*>(
         getCache()
-            ->getPoolManager()
+            .getPoolManager()
             .find(m_regionAttributes->getPoolName())
             .get());
     m_tcrdm = dynamic_cast<ThinClientBaseDM*>(poolDM);
diff --git a/cppcache/src/ThinClientRegion.cpp b/cppcache/src/ThinClientRegion.cpp
index d92d94a..e2ab53e 100644
--- a/cppcache/src/ThinClientRegion.cpp
+++ b/cppcache/src/ThinClientRegion.cpp
@@ -91,7 +91,7 @@ class PutAllWork : public PooledWork<GfErrType>,
         m_isPapeReceived(false)
   // UNUSED , m_aCallbackArgument(aCallbackArgument)
   {
-    m_request = new TcrMessagePutAll(m_region->getCache()->createDataOutput(),
+    m_request = new TcrMessagePutAll(m_region->getCache().createDataOutput(),
                                      m_region.get(), *m_map.get(), m_timeout,
                                      m_poolDM, aCallbackArgument);
     m_reply = new TcrMessageReply(true, m_poolDM);
@@ -236,7 +236,7 @@ class RemoveAllWork : public PooledWork<GfErrType>,
         m_papException(nullptr),
         m_isPapeReceived(false) {
     m_request = new TcrMessageRemoveAll(
-        m_region->getCache()->createDataOutput(), m_region.get(), *keys,
+        m_region->getCache().createDataOutput(), m_region.get(), *keys,
         m_aCallbackArgument, m_poolDM);
     m_reply = new TcrMessageReply(true, m_poolDM);
     // create new instanceof VCOPL
@@ -1366,7 +1366,7 @@ GfErrType ThinClientRegion::singleHopPutAllNoThrow_remote(
    */
   std::vector<PutAllWork*> putAllWorkers;
   auto threadPool =
-      CacheRegionHelper::getCacheImpl(getCache().get())->getThreadPool();
+      CacheRegionHelper::getCacheImpl(&getCache())->getThreadPool();
   int locationMapIndex = 0;
   for (const auto& locationIter : *locationMap) {
     const auto& serverLocation = locationIter.first;
@@ -1746,7 +1746,7 @@ GfErrType ThinClientRegion::singleHopRemoveAllNoThrow_remote(
    */
   std::vector<RemoveAllWork*> removeAllWorkers;
   auto* threadPool =
-      CacheRegionHelper::getCacheImpl(getCache().get())->getThreadPool();
+      CacheRegionHelper::getCacheImpl(&getCache())->getThreadPool();
   int locationMapIndex = 0;
   for (const auto& locationIter : *locationMap) {
     const auto& serverLocation = locationIter.first;
@@ -3197,7 +3197,7 @@ bool ThinClientRegion::executeFunctionSH(
       TSSUserAttributesWrapper::s_geodeTSSUserAttributes->getUserAttributes();
   std::vector<std::shared_ptr<OnRegionFunctionExecution>> feWorkers;
   auto* threadPool =
-      CacheRegionHelper::getCacheImpl(getCache().get())->getThreadPool();
+      CacheRegionHelper::getCacheImpl(&getCache())->getThreadPool();
 
   for (const auto& locationIter : *locationMap) {
     const auto& serverLocation = locationIter.first;
diff --git a/cppcache/src/TypeRegistry.cpp b/cppcache/src/TypeRegistry.cpp
index 4e911c0..e5d2314 100644
--- a/cppcache/src/TypeRegistry.cpp
+++ b/cppcache/src/TypeRegistry.cpp
@@ -23,23 +23,20 @@
   TypeRegistry is the public facing wrapper for the serialization registry.
 **/
 
-TypeRegistry::TypeRegistry(const Cache &cache) : m_cache(cache) {}
+TypeRegistry::TypeRegistry(CacheImpl* cache) : m_cache(cache) {}
 
 void TypeRegistry::registerType(TypeFactoryMethod creationFunction) {
-  CacheRegionHelper::getCacheImpl(&m_cache)
-      ->getSerializationRegistry()
-      ->addType(creationFunction);
+  m_cache->getSerializationRegistry()
+         ->addType(creationFunction);
 }
 
 void TypeRegistry::registerPdxType(TypeFactoryMethodPdx creationFunction) {
-  CacheRegionHelper::getCacheImpl(&m_cache)
-      ->getSerializationRegistry()
-      ->addPdxType(creationFunction);
+  m_cache->getSerializationRegistry()
+         ->addPdxType(creationFunction);
 }
 
 void TypeRegistry::registerPdxSerializer(
     std::shared_ptr<PdxSerializer> pdxSerializer) {
-  CacheRegionHelper::getCacheImpl(&m_cache)
-      ->getSerializationRegistry()
-      ->setPdxSerializer(pdxSerializer);
+  m_cache->getSerializationRegistry()
+         ->setPdxSerializer(pdxSerializer);
 }
diff --git a/cppcache/src/statistics/HostStatSampler.cpp b/cppcache/src/statistics/HostStatSampler.cpp
index 030657c..bd67ac0 100644
--- a/cppcache/src/statistics/HostStatSampler.cpp
+++ b/cppcache/src/statistics/HostStatSampler.cpp
@@ -130,7 +130,7 @@ const char* HostStatSampler::NC_HSS_Thread = "NC HSS Thread";
 
 HostStatSampler::HostStatSampler(const char* filePath,
                                  std::chrono::milliseconds sampleIntervalMs,
-                                 StatisticsManager* statMngr, Cache* cache,
+                                 StatisticsManager* statMngr, CacheImpl* cache,
                                  const char* durableClientId,
                                  const std::chrono::seconds durableTimeout,
                                  int64_t statFileLimit,
diff --git a/cppcache/src/statistics/HostStatSampler.hpp b/cppcache/src/statistics/HostStatSampler.hpp
index 9646620..3a768e8 100644
--- a/cppcache/src/statistics/HostStatSampler.hpp
+++ b/cppcache/src/statistics/HostStatSampler.hpp
@@ -83,7 +83,7 @@ class CPPCACHE_EXPORT HostStatSampler : public ACE_Task_Base,
    */
   HostStatSampler(const char* filePath,
                   std::chrono::milliseconds sampleIntervalMs,
-                  StatisticsManager* statMngr, Cache* cache,
+                  StatisticsManager* statMngr, CacheImpl* cache,
                   const char* durableClientId,
                   const std::chrono::seconds durableTimeout,
                   int64_t statFileLimit = 0, int64_t statDiskSpaceLimit = 0);
@@ -218,7 +218,7 @@ class CPPCACHE_EXPORT HostStatSampler : public ACE_Task_Base,
   int64_t m_archiveDiskSpaceLimit;
   std::chrono::milliseconds m_sampleRate;
   StatisticsManager* m_statMngr;
-  Cache* m_cache;
+  CacheImpl* m_cache;
 
   int64_t m_pid;
   system_clock::time_point m_startTime;
diff --git a/cppcache/src/statistics/StatArchiveWriter.cpp b/cppcache/src/statistics/StatArchiveWriter.cpp
index 47f03ec..ac63a2d 100644
--- a/cppcache/src/statistics/StatArchiveWriter.cpp
+++ b/cppcache/src/statistics/StatArchiveWriter.cpp
@@ -26,6 +26,7 @@
 
 #include "StatArchiveWriter.hpp"
 #include "GeodeStatisticsFactory.hpp"
+#include "CacheImpl.hpp"
 
 namespace apache {
 namespace geode {
@@ -39,14 +40,18 @@ using std::chrono::nanoseconds;
 
 // Constructor and Member functions of StatDataOutput class
 
-StatDataOutput::StatDataOutput(std::string filename, Cache *cache) {
+StatDataOutput::StatDataOutput(CacheImpl* cache) : bytesWritten(0), m_fp(nullptr), closed(false) {
+  dataBuffer = cache->getCache()->createDataOutput();
+}
+
+StatDataOutput::StatDataOutput(std::string filename, CacheImpl* cache) {
   if (filename.length() == 0) {
     std::string s("undefined archive file name");
     throw IllegalArgumentException(s.c_str());
   }
 
   SerializationRegistry serializationRegistry;
-  dataBuffer = cache->createDataOutput();
+  dataBuffer = cache->getCache()->createDataOutput();
   outFile = filename;
   closed = false;
   bytesWritten = 0;
@@ -314,7 +319,7 @@ void ResourceInst::writeResourceInst(StatDataOutput *dataOutArg,
 
 // Constructor and Member functions of StatArchiveWriter class
 StatArchiveWriter::StatArchiveWriter(std::string outfile,
-                                     HostStatSampler *samplerArg, Cache *cache)
+                                     HostStatSampler *samplerArg, CacheImpl* cache)
     : cache(cache) {
   resourceTypeId = 0;
   resourceInstId = 0;
diff --git a/cppcache/src/statistics/StatArchiveWriter.hpp b/cppcache/src/statistics/StatArchiveWriter.hpp
index 6f77c6d..a677a69 100644
--- a/cppcache/src/statistics/StatArchiveWriter.hpp
+++ b/cppcache/src/statistics/StatArchiveWriter.hpp
@@ -79,10 +79,8 @@ using std::chrono::steady_clock;
 
 class CPPCACHE_EXPORT StatDataOutput {
  public:
-  StatDataOutput(Cache *cache) : bytesWritten(0), m_fp(nullptr), closed(false) {
-    dataBuffer = cache->createDataOutput();
-  }
-  StatDataOutput(std::string, Cache *cache);
+  StatDataOutput(CacheImpl* cache);
+  StatDataOutput(std::string, CacheImpl* cache);
   ~StatDataOutput();
   /**
    * Returns the number of bytes written into the buffer so far.
@@ -207,7 +205,7 @@ class CPPCACHE_EXPORT StatArchiveWriter {
  private:
   HostStatSampler *sampler;
   StatDataOutput *dataBuffer;
-  Cache *cache;
+  CacheImpl* cache;
   steady_clock::time_point previousTimeStamp;
   int32_t resourceTypeId;
   int32_t resourceInstId;
@@ -230,7 +228,7 @@ class CPPCACHE_EXPORT StatArchiveWriter {
 
  public:
   StatArchiveWriter(std::string archiveName, HostStatSampler *sampler,
-                    Cache *cache);
+                    CacheImpl* cache);
   ~StatArchiveWriter();
   /**
    * Returns the number of bytes written so far to this archive.
diff --git a/cppcache/src/statistics/StatisticsManager.cpp b/cppcache/src/statistics/StatisticsManager.cpp
index 2732bcf..402a84a 100644
--- a/cppcache/src/statistics/StatisticsManager.cpp
+++ b/cppcache/src/statistics/StatisticsManager.cpp
@@ -39,7 +39,7 @@ using namespace apache::geode::statistics;
 
 StatisticsManager::StatisticsManager(
     const char* filePath, const std::chrono::milliseconds sampleInterval,
-    bool enabled, Cache* cache, const char* durableClientId,
+    bool enabled, CacheImpl* cache, const char* durableClientId,
     const std::chrono::seconds durableTimeout, int64_t statFileLimit,
     int64_t statDiskSpaceLimit)
     : m_sampleIntervalMs(sampleInterval),
diff --git a/cppcache/src/statistics/StatisticsManager.hpp b/cppcache/src/statistics/StatisticsManager.hpp
index f5f5f5d..907764d 100644
--- a/cppcache/src/statistics/StatisticsManager.hpp
+++ b/cppcache/src/statistics/StatisticsManager.hpp
@@ -68,7 +68,7 @@ class StatisticsManager {
  public:
   StatisticsManager(const char* filePath,
                     std::chrono::milliseconds sampleIntervalMs, bool enabled,
-                    Cache* cache, const char* durableClientId,
+                    apache::geode::client::CacheImpl* cache, const char* durableClientId,
                     const std::chrono::seconds durableTimeout,
                     int64_t statFileLimit = 0, int64_t statDiskSpaceLimit = 0);
 
@@ -108,7 +108,6 @@ class StatisticsManager {
   GeodeStatisticsFactory* getStatisticsFactory() const {
     return m_statisticsFactory.get();
   }
-
 };  // class
 
 }  // namespace statistics
diff --git a/cppcache/test/PdxLocalReaderTest.cpp b/cppcache/test/PdxLocalReaderTest.cpp
index cbd43ee..90f256e 100644
--- a/cppcache/test/PdxLocalReaderTest.cpp
+++ b/cppcache/test/PdxLocalReaderTest.cpp
@@ -67,7 +67,7 @@ class DISABLED_PdxLocalReaderTest : public ::testing::Test {
  public:
   void SetUp() {
     auto factory = CacheFactory::createCacheFactory();
-    cache = factory->create();
+    cache = std::make_shared<Cache>(factory->create());
   }
 
  protected:
diff --git a/sqliteimpl/SqLiteImpl.cpp b/sqliteimpl/SqLiteImpl.cpp
index 0de4e99..d086d60 100644
--- a/sqliteimpl/SqLiteImpl.cpp
+++ b/sqliteimpl/SqLiteImpl.cpp
@@ -113,9 +113,9 @@ void SqLiteImpl::write(const std::shared_ptr<CacheableKey>& key,
                        const std::shared_ptr<Cacheable>& value,
                        void*& dbHandle) {
   // Serialize key and value.
-  auto* cache = m_regionPtr->getCache().get();
-  auto keyDataBuffer = cache->createDataOutput();
-  auto valueDataBuffer = cache->createDataOutput();
+  auto& cache = m_regionPtr->getCache();
+  auto keyDataBuffer = cache.createDataOutput();
+  auto valueDataBuffer = cache.createDataOutput();
   uint32_t keyBufferSize, valueBufferSize;
 
   keyDataBuffer->writeObject(key);
@@ -134,7 +134,7 @@ bool SqLiteImpl::writeAll() { return true; }
 std::shared_ptr<Cacheable> SqLiteImpl::read(
     const std::shared_ptr<CacheableKey>& key, void*& dbHandle) {
   // Serialize key.
-  auto keyDataBuffer = m_regionPtr->getCache()->createDataOutput();
+  auto keyDataBuffer = m_regionPtr->getCache().createDataOutput();
   uint32_t keyBufferSize;
   keyDataBuffer->writeObject(key);
   void* keyData = const_cast<uint8_t*>(keyDataBuffer->getBuffer(&keyBufferSize));
@@ -147,7 +147,7 @@ std::shared_ptr<Cacheable> SqLiteImpl::read(
   }
 
   // Deserialize object and return value.
-  auto valueDataBuffer = m_regionPtr->getCache()->createDataInput(
+  auto valueDataBuffer = m_regionPtr->getCache().createDataInput(
       reinterpret_cast<uint8_t*>(valueData), valueBufferSize);
   std::shared_ptr<Cacheable> retValue;
   valueDataBuffer->readObject(retValue);
@@ -177,7 +177,7 @@ void SqLiteImpl::destroyRegion() {
 
 void SqLiteImpl::destroy(const std::shared_ptr<CacheableKey>& key, void*& dbHandle) {
   // Serialize key and value.
-  auto keyDataBuffer = m_regionPtr->getCache()->createDataOutput();
+  auto keyDataBuffer = m_regionPtr->getCache().createDataOutput();
   uint32_t keyBufferSize;
   keyDataBuffer->writeObject(key);
   void* keyData = const_cast<uint8_t*>(keyDataBuffer->getBuffer(&keyBufferSize));
diff --git a/tests/cpp/fwklib/FrameworkTest.cpp b/tests/cpp/fwklib/FrameworkTest.cpp
index dd0024e..d0da6bc 100644
--- a/tests/cpp/fwklib/FrameworkTest.cpp
+++ b/tests/cpp/fwklib/FrameworkTest.cpp
@@ -261,7 +261,7 @@ void FrameworkTest::cacheInitialize(
   }
 
   try {
-    m_cache = cacheFactory->create();
+    m_cache = std::make_shared<Cache>(cacheFactory->create());
     bool m_istransaction = getBoolValue("useTransactions");
     if (m_istransaction) {
       txManager = m_cache->getCacheTransactionManager();
diff --git a/tests/cpp/fwklib/FwkObjects.cpp b/tests/cpp/fwklib/FwkObjects.cpp
index adbb754..93aaf83 100644
--- a/tests/cpp/fwklib/FwkObjects.cpp
+++ b/tests/cpp/fwklib/FwkObjects.cpp
@@ -577,8 +577,8 @@ Attributes::Attributes(const DOMNode* node)
 FwkPool::FwkPool(const DOMNode* node) : m_locators(false), m_servers(false) {
   // Init Factory
   auto cacheFactory = CacheFactory::createCacheFactory();
-  m_cache = cacheFactory->create();
-  m_poolManager = new PoolManager(*m_cache);
+  m_cache = std::make_shared<Cache>(cacheFactory->create());
+  m_poolManager = &m_cache->getPoolManager();
   m_poolFactory = m_poolManager->createFactory();
   // Set Attrs to Pool
   setAttributesToFactory(node);

-- 
To stop receiving notification emails like this one, please contact
['"commits@geode.apache.org" <commits@geode.apache.org>'].

Mime
View raw message