recently in the project need to use Infinispan and the Redis two frames, refer to the Official Configuration guide infinispan-redis configuration , in Eclipse always prompt for error messages in configuration settings ( do not know where to write wrong, or how ) after several rewrite tests, the following configuration will not prompt the error message.
<?xml version= "1.0" encoding= "UTF-8"? ><infinispan xmlns:xsi= "http://www.w3.org/2001/ Xmlschema-instance " xsi:schemalocation=" urn:infinispan:config:8.0 urn:infinispan:config:store:redis:8.0 http://www.infinispan.org/schemas/ infinispan-cachestore-redis-config-8.0.xsd http://www.infinispan.org/schemas/infinispan-config-8.0.xsd " xmlns= "urn:infinispan:config:8.0" xmlns:redis= "Urn:infinispan:config:store:redis : 8.0 " > <cache-container default-cache=" Platform-data-cache "> <jmx domain= "Org.infinispan" duplicate-domains= "true" > </jmx> <local-cache name= "PlatformDataCache" > <persistence passivation= "false" > <redis-store topology= " Server " password=" Pwd4redis " xmlns=" urn:infinispan:config:store:redis:8.0 " socket-timeout = "10000" connection-timeout= "10000" > <redis-server host= "192.168.1.101" port= " 6379 " /> <connection-pool min-idle= " max-idle=" " max-total=" Min-evictable-idle-time= " time-between-eviction-runs=" "1800" /> </redis-store> </persistence> </ Local-cache> </cache-container></infinispan>
The configuration in Spring-context.xml is as follows:
<bean id= "CacheManager" class= "Org.infinispan.manager.DefaultCacheManager" > <constructor-arg name= " ConfigurationFile "value=" Infinispan.xml "> </constructor-arg> </bean> <bean id=" Platformcache " Factory-bean= "CacheManager" factory-method= "GetCache" > <!--can add Constructor-args parameters to get the corresponding cache instance, Without this parameter get the default cache instance-<constructor-arg name= "CacheName" value= "Platformdatacache" > </constructor-arg> </bean>
How to use annotations in Java code:
public class InfinispanCache { @Resource (name = "Platformcache") private cache<string, object> secondcache; public cache<string, object> getsecondcache () { return secondCache; } public void setsecondcache (Cache<string, object> secondcache) { this.secondCache = secondCache; } //other Code &NBSP;&NBsp; }
Or, you define bean dependencies in Spring-context.xml:
<bean id= "Secondcachemanager" class= "Com.test.data.cache.InfinispanCache" > <property name= "Secondcache" ref= "Platformcache"/> </bean>
By following the configuration settings above, it is important to note that the log level cannot be the debug,debug level when initiating a Infinispan initialization error (Infinispan-redis is not known here).
This article from "Good memory than bad writing" blog, please be sure to keep this source http://tener.blog.51cto.com/1065457/1736185
Infinispan-redis configuration using