简体   繁体   中英

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM