geode-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <>
Subject [jira] [Commented] (GEODE-3645) Update API CacheFactory::create to return cache object
Date Wed, 29 Nov 2017 18:08:02 GMT


ASF GitHub Bot commented on GEODE-3645:

pivotal-jbarrett commented on a change in pull request #159: GEODE-3645: Update CacheFactory::create
to return Cache by value

 File path: cppcache/integration-test/CacheHelper.cpp
 @@ -127,7 +129,8 @@ CacheHelper::CacheHelper(const std::shared_ptr<Properties>&
     pp = Properties::create();
-  cachePtr = CacheFactory::createCacheFactory(pp)->create();
+  auto cacheFactory = CacheFactory::createCacheFactory(pp);
+  cachePtr.reset(new Cache(cacheFactory->create()));
 Review comment:
   I think I prefer:
   cachePtr = std::make_shared<Cache>(cacheFactory->create());
   It results in a single allocation of the `Cache` and control blocks for the shared pinter
and they get moved into the existing shared_ptr. Calling reset results in two allocation,
one for the Cache and another for the new control block.

This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:

> Update API CacheFactory::create to return cache object
> ------------------------------------------------------
>                 Key: GEODE-3645
>                 URL:
>             Project: Geode
>          Issue Type: New Feature
>          Components: native client
>            Reporter: David Kimura
> As an application developer I want to control the stack vs heap allocation of my cache
object.  If we change CacheFactory::create to return a cache object then the application user
can pick an allocation scheme.  This also allows application developers to bypass smart pointer
complexity until the developer deems them necessary.
> Example:
> {noformat}
> auto cache = CacheFactory::createFactory().create();
> auto cacheptr = std::make_shared<Cache>(CacheFactory::createFactory().create());
> {noformat}
> Difficulty of implementation is due to Cache/CacheImpl circular dependency.  Here are
a few examples of various approaches to consider:
> Here are the related email threads of interest:

This message was sent by Atlassian JIRA

View raw message