您好 ApacheIgnite 团队,
我计划使用 C++ 瘦客户端创建动态缓存,并希望将事务用于某些操作。 C++ 瘦客户端中是否有规定将 Automicity 模式的缓存配置设置为事务性?
ignite::thin::IgniteClientConfiguration cfg;
cfg.SetEndPoints("10.1.53.61:10800");
cfg.SetPartitionAwareness(true);
m_igniteClient = ignite::thin::IgniteClient::Start(cfg);
ignite::thin::cache::CacheClient<int16_t, std::string> client =
m_igniteClient.GetOrCreateCache<int16_t, std::string>(cacheName.c_str());
IgniteClientConfiguration 或 ignite::thin::IgniteClient 没有任何 API 来设置自动模式。
请注意,缓存是使用瘦客户端 C++ 动态创建的。
有没有其他方法可以使用瘦客户端C++实现交易?
您可以在服务器上定义缓存模板 [1],并使用它从 C++ 瘦客户端动态创建缓存
*
的缓存配置 - 缓存不会启动,但会创建一个模板<bean class="org.apache.ignite.configuration.IgniteConfiguration">
<property name="cacheConfiguration">
<list>
<bean abstract="true" class="org.apache.ignite.configuration.CacheConfiguration" id="cache-template-bean">
<!-- when you create a template via XML configuration, you must add an asterisk to the name of the template -->
<property name="name" value="tx-cache-*"/>
<property name="atomicity" value="TRANSACTIONAL"/>
<!-- Other cache parameters -->
</bean>
</list>
</property>
</bean>
// Create transactional cache from template
auto cache = m_igniteClient.GetOrCreateCache<int16_t, std::string>(
"tx-cache-foobar1");
[1] https://ignite.apache.org/docs/latest/configuring-caches/configuration-overview#cache-templates