实现自定义缓存存储

Implementing Custom Cache Store

刚刚基于官方现有的 RocksDb 实现了一个自定义缓存存储,用于不同的后端存储。

这让我想到了一些 concerns/questions:

Found out the hard way that PersistenceContextInitializerImpl is auto-generated and had added an import from Eclipse to resolve the issue. Now I have to leave it non-imported and showing as an error in Eclipse, is there a best practice way to handle this?

应该有办法让它成为注释处理器 运行。我们使用 IntelliJ,它在 OOTB 时运行良好。

Why is RocksDBDbStoreTest#testSegmentsRemovedAndAdded call when segmented is false, since this calls removeSegments that contractually should not be called if not segmented?

这只是进行这样的参数化测试的副作用。在实际 运行 时间内,它不会被调用。如果它被分段,你可以让测试忽略它。

if (segmented) return;

Same class, why is buildConfig numSegments set or larger than 1 for non-segmented test cases?

在任何集群模式下 运行Infinispan 数据容器总是分段的。然而,在这些情况下不需要对商店进行分段。如果商店未分段,您可以忽略记录的任何分段参数。

Any example of store implementing the NonBlockingStore transactional methods? Mostly wondering to make sure that all calls are from the same thread?

您可以在 https://github.com/infinispan/infinispan/blob/main/persistence/jdbc/src/main/java/org/infinispan/persistence/jdbc/stringbased/JdbcStringBasedStore.java#L724 看到一些。这些方法可以并且将会从不同的方法中调用,因此它存储由事务键控的映射的原因。

Wanted to disable the compatibility test, since not supported in prior versions. Changed group to unstable or manual and would always still get called, which doesn't seem to match documentation. What is the right way to disable it from build time run?

不确定我是否理解问题。对于您的商店,您不需要任何兼容性测试,所以不要复制该测试文件。

Are there any kind of performance/stress tests for persistence store that can be executed or adapted?

我们有 https://github.com/infinispan/infinispan-benchmarks/blob/main/cachestores/src/main/java/org/infinispan/jmhbenchmarks/InfinispanHolder.java 应该有效。