3.8. 从 Hot Rod 客户端创建远程缓存
使用 Data Grid Hot Rod API 从 Java、C++、.NET/C#、JS 客户端等在 Data Grid Server 上创建远程缓存。
此步骤显示如何使用 Hot Rod Java 客户端在首次访问时创建远程缓存。您可以在 Data Grid Tutorials 中找到其他 Hot Rod 客户端的代码示例。
先决条件
-
创建具有
admin
权限的 Data Grid 用户。 - 至少一个 Data Grid Server 实例。
- 具有数据网格缓存配置。
流程
-
作为
ConfigurationBuilder
的一部分调用remoteCache()
方法。 -
在 classpath 上的
hotrod-client.properties
文件中设置configuration
或configuration_uri
属性。
ConfigurationBuilder
hotrod-client.properties
infinispan.client.hotrod.cache.another-cache.configuration=<distributed-cache name=\"another-cache\"/> infinispan.client.hotrod.cache.[my.other.cache].configuration_uri=file:///path/to/infinispan.xml
infinispan.client.hotrod.cache.another-cache.configuration=<distributed-cache name=\"another-cache\"/>
infinispan.client.hotrod.cache.[my.other.cache].configuration_uri=file:///path/to/infinispan.xml
重要
如果您的远程缓存的名称包含 .
字符,那么在使用 hotrod-client.properties
文件时,您必须用方括号括起来。