【发布时间】:2022-01-15 20:57:11
【问题描述】:
我正在尝试在后端使用 Apache Ignite 和 Couchbase 作为持久层。我将其作为数据网格进行操作,以便为启动内存缓存所做的任何更改最终都会写入 couchbase。我正在使用 spring-boot 和 spring-data 来实现这一点。 igniteConfiguration bean 看起来像这样
@Bean(name = "igniteConfiguration")
public IgniteConfiguration igniteConfiguration() {
IgniteConfiguration igniteConfiguration = new IgniteConfiguration();
CacheConfiguration cache = new CacheConfiguration("sample");
cache.setAtomicityMode(CacheAtomicityMode.ATOMIC);
//The below line where I am confused
cache.setCacheStoreFactory(FactoryBuilder.factoryOf(CacheStoreImplementationWithCouchbaseRepositoryBean.class);
cache.setCacheStoreSessionListenerFactories()
cache.setReadThrough(true);
cache.setWriteThrough(true);
igniteConfiguration.setCacheConfiguration(cache);
return igniteConfiguration;
}
我需要提供 Ignite 的 cacheStore 接口的一种实现,以便将 couchbase 连接为后端数据存储。我配置了 Couchbase Repository 类并在 CacheStoreImplementationWithCouchbaseRepositoryBean.java 中创建了它的一个 bean。但是这个存储库 bean 没有被启动,因为 CacheStoreImplementation 类不在 spring 上下文中并且总是为 null。
当我使用弹簧数据时。现在我有
- Ignite 的 Spring 数据存储库
- couchbase 的 Spring 数据存储库
- ignite的cacheStore接口的一种实现
但不确定如何以某种方式将 couchbase 存储库 bean 发送到 cacheStore 实现,以便它使用此存储库类在内部执行 couchbase 中的 crud 操作。
【问题讨论】:
标签: java spring-boot spring-data couchbase ignite