Ikthiander
Ikthiander

Reputation: 3917

configuring infinispan in jboss 7 programmatically

is there a way i can take away the configuration of infinispan completely from the standalone.xml and have the configuration like the following in my persistence.xml :

<property name="hibernate.cache.infinispan.entity.strategy" value= "LRU" />
<property name="hibernate.cache.infinispan.entity.eviction.max_entries" value= "1000"/>
<property name="hibernate.cache.infinispan.entity.eviction.strategy" value= "LRU"/>
<property name="hibernate.cache.infinispan.entity.eviction.wake_up_interval" value= "2000"/>
<property name="hibernate.cache.infinispan.entity.eviction.max_entries" value= "5000"/>
<property name="hibernate.cache.infinispan.entity.expiration.lifespan" value= "60000"/>
<property name="hibernate.cache.infinispan.entity.expiration.max_idle" value= "30000"/>

thanks in advance

Upvotes: 0

Views: 1312

Answers (1)

tsykora
tsykora

Reputation: 733

I don't know your use case but there is a possibility to configure Infinispan CacheManagers and Caches programmatically using fluent builder API. It means no need of standalone.xml and even no need of configuration for Infinispan in persistence.xml.

For more information see: https://docs.jboss.org/author/display/ISPN/Configuring+cache+programmatically

In this tutorial I can see configuration of CacheManager like this (which can be confusing now):

  EmbeddedCacheManager manager = new DefaultCacheManager("my-config-file.xml");

You can configure it entirely programmatically too without any input xml file, for example:

  GlobalConfigurationBuilder global = new GlobalConfigurationBuilder();
  global.transport().defaultTransport();
  global.globalJmxStatistics().enable();
  manager = new DefaultCacheManager(global.build()); 

Upvotes: 1

Related Questions