Infinispan 9提供了以下方法来设置整体缓存级别的到期时间。有没有办法使用Infinispan 6.4.0(这没有expiration()方法)
Infinispan 9:
org.infinispan.client.hotrod.configuration.ConfigurationBuilder
new ConfigurationBuilder().expiration()
.lifespan(1, TimeUnit.SECONDS)
.build();
Spring cache + Infinispan 6(远程缓存管理器)
<bean id="remoteCacheManager" class="org.infinispan.client.hotrod.RemoteCacheManager">
<constructor-arg name="configuration" ref="cacheConfiguration" />
<constructor-arg type = "boolean" value="true" />
</bean>
<bean id="springRemoteCacheManager" class="org.infinispan.spring.provider.SpringRemoteCacheManager">
<constructor-arg name="nativeCacheManager" ref="remoteCacheManager" />
</bean>
@Bean(name="cacheConfiguration")
...{
org.infinispan.client.hotrod.configuration.ConfigurationBuilder builder = new org.infinispan.client.hotrod.configuration.ConfigurationBuilder();
for(String jdgServer : jdgServers) {
builder.addServer()
.host(jdgServer)
.port(port)
.connectionTimeout(connectionTimeout);
return builder.build();
}
答案 0 :(得分:1)
看起来你已经越过了不同的ConfigurationBuilder类。你要找的是org.infinispan.cache.configuration.ConfigurationBuilder。 Infinispan 6.x在那里有到期元素。您引用的org.infinispan.client.hotrod.configuration.ConfigurationBuilder用于配置远程客户端。
与往常一样,建议升级到更新的版本:)