我有以下配置使用
org.infinispan', name: 'infinispan-spring4-common', version: '9.1.7.Final'
问题是如何以编程方式创建缓存?或者如何在 infinispan 服务器启动期间创建缓存?
我无法创建标签“infinispan-as-spring-cache-provider”有人可以帮我吗?
@Configuration
@Profile("infinispan-standalone")
@EnableCaching
public class InfinispanStandaloneConfig {
private static final Logger logger = LoggerFactory.getLogger(InfinispanCacheConfiguration.class);
@Autowired
@Bean
public RemoteCacheManager remoteCacheManager(@Value("${infinispan.remote.server-list}") String serverlist,
@Value("infinispan.admin.user") String user,
@Value("infinispan.admin.password") String pwd) {
logger.info("inside the remote cache manager");
Properties properties = new Properties();
properties.setProperty("infinispan.client.hotrod.client_intelligence", "BASIC");
properties.setProperty("infinispan.client.hotrod.marshaller", "org.infinispan.commons.marshall.jboss.GenericJBossMarshaller");
RemoteCacheManager remoteCacheManager = new RemoteCacheManager(new ConfigurationBuilder().addServers(serverlist).withProperties(properties)
.security().authentication().username(user).password(pwd)
.build());
remoteCacheManager.getCache("cart",true);
return remoteCacheManager;
}
@Bean
public SpringRemoteCacheManager cacheManager(RemoteCacheManager remoteCacheManager) {
return new SpringRemoteCacheManager(remoteCacheManager);
}
}