Infinispan-redis configuration using

Source: Internet
Author: User
Tags configuration settings infinispan

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.