Priyanka
Priyanka

Reputation: 1

Infinispan lifespan settings in version 6.4.0

Infinispan 9 provides the below methods to set an expiry at overall cache level. Is there an way to do this using Infinispan 6.4.0 (this does not have expiration() method)

Infinispan 9:

org.infinispan.client.hotrod.configuration.ConfigurationBuilder

new ConfigurationBuilder().expiration()
  .lifespan(1, TimeUnit.SECONDS)
  .build();

Spring cache + Infinispan 6 (remote cache manager)

<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();
}

Upvotes: 0

Views: 252

Answers (1)

Mudokonman
Mudokonman

Reputation: 901

It looks like you have crossed up the different ConfigurationBuilder classes. The one you are looking for is org.infinispan.cache.configuration.ConfigurationBuilder. Infinispan 6.x has the expiration element there. The org.infinispan.client.hotrod.configuration.ConfigurationBuilder you referenced is for configuring the remote client.

As always, it is recommended to upgrade to a more recent version though :)

Upvotes: 1

Related Questions