ClientCacheConfiguration 未保存到 table

ClientCacheConfiguration is not saved to table

一直在 Ignite 中使用 CacheConfiguration,直到我遇到有关如何进行身份验证的问题。 因此,我开始将 CacheConfiguration 更改为 clientCacheConfiguration。但是在将它转换为 CacheConfiguration 之后我开始注意到它 无法保存到 table 因为它缺少方法 setIndexedTypes 例如。 之前

CacheConfiguration<String, IgniteParRate> cacheCfg = new CacheConfiguration<>();
cacheCfg.setName(APIConstants.CACHE_PARRATES);
cacheCfg.setIndexedTypes(String.class, IgniteParRate.class);

新建

ClientCacheConfiguration cacheCfg = new ClientCacheConfiguration();
cacheCfg.setName(APIConstants.CACHE_PARRATES);
//cacheCfg.setIndexedTypes(String.class, IgniteParRate.class);  --> this is not provided

我仍然需要填充 table 以便我们更容易验证(使用像 DBeaver 一样的客户端 IDE) 有什么办法可以解决这个问题?

如果您需要使用瘦客户端动态创建 tables/cache,您将需要使用 setQueryEntities() 方法来定义可用于 SQL [=16= 的列]. (通过注释传递 ​​类 基本上是定义查询实体的快捷方式。)我不确定为什么 setIndexedTypes() 在瘦客户端中不可用;也许是开发者邮件列表的问题。

或者,您可以使用胖客户端预先定义 caches/tables。使用瘦客户端时它们仍然可用。

要添加到现有答案,您还可以尝试为此使用缓存模板。 https://apacheignite.readme.io/docs/cache-template

预配置模板,在从瘦客户端创建缓存时使用它们。