public static void main(String[] args) {
ConfigurationBuilder cfg = ...
RemoteCacheManager rcm = new RemoteCacheManager(build);
String xml = String.format(
"<infinispan>" +
"<cache-container>" +
"<distributed-cache name=\"%1$s\">" +
"<persistence passivation=\"false\">" +
"<file-store " +
"shared=\"false\" " +
"fetch-state=\"true\" " +
"path=\"${jboss.server.data.dir}/datagrid-infinispan/%1$s\"" +
"/>" +
"</persistence>" +
"</distributed-cache>" +
"</cache-container>" +
"</infinispan>",
"cacheName"
);
RemoteCache<Object, Object> index = rcm.administration()
//Include a flag to make the cache permanent.
.withFlags(CacheContainerAdmin.AdminFlag.PERMANENT)
//Create a cache with the XML configuration
.createCache("cacheName", new XMLStringConfiguration(xml));
System.out.println(index.size());
}
public static void main(String[] args) {
ConfigurationBuilder cfg = ...
RemoteCacheManager rcm = new RemoteCacheManager(build);
String xml = String.format(
"<infinispan>" +
"<cache-container>" +
"<distributed-cache name=\"%1$s\">" +
"<persistence passivation=\"false\">" +
"<file-store " +
"shared=\"false\" " +
"fetch-state=\"true\" " +
"path=\"${jboss.server.data.dir}/datagrid-infinispan/%1$s\"" +
"/>" +
"</persistence>" +
"</distributed-cache>" +
"</cache-container>" +
"</infinispan>",
"cacheName"
);
RemoteCache<Object, Object> index = rcm.administration()
//Include a flag to make the cache permanent.
.withFlags(CacheContainerAdmin.AdminFlag.PERMANENT)
//Create a cache with the XML configuration
.createCache("cacheName", new XMLStringConfiguration(xml));
System.out.println(index.size());
}
Copy to Clipboard
Copied!
Toggle word wrap
Toggle overflow