First step: Install the memcached server on a Linux machine or on a Windows machine
Install Memcached:centos in linux command yum-y installed memcached
If there is no network download mencached installation package (note: Need to install dependent libevent)
Download the installation package from the Internet, unzip the Make&&make install and complete the
The second step: the project imports the memcached client jar (clients) with two versions, select the 2.4
Step three: Spring integrated memcached (Memcached.xml)
<?xml version= "1.0" encoding= "UTF-8"?>
<beans xmlns= "Http://www.springframework.org/schema/beans"
Xmlns:xsi= "Http://www.w3.org/2001/XMLSchema-instance" xmlns:aop= "HTTP://WWW.SPRINGFRAMEWORK.ORG/SCHEMA/AOP"
xmlns:tx= "Http://www.springframework.org/schema/tx" xmlns:jdbc= "Http://www.springframework.org/schema/jdbc"
xmlns:context= "Http://www.springframework.org/schema/context"
Xsi:schemalocation= "
Http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
Http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
Http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc-3.0.xsd
Http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
HTTP://WWW.SPRINGFRAMEWORK.ORG/SCHEMA/AOP http://www.springframework.org/schema/aop/spring-aop-3.0.xsd ">
<!--Memcached Configuration--
<bean id= "memcachedclient" class= "Com.danga.MemCached.MemCachedClient" >
<constructor-arg>
<value>sockIOPool</value>
</constructor-arg>
</bean>
<!--memcached Connection pool--
<bean id= "Sockiopool" class= "Com.danga.MemCached.SockIOPool" factory-method= "getinstance" init-method= " Initialize "destroy-method=" ShutDown ">
<constructor-arg>
<value>sockIOPool</value>
</constructor-arg>
<property name= "Servers" >
<list>
<!--memcached clusters, there are a few of them listed in 11211 for the port number--
<value>192.168.200.149:11211</value>
<value>192.168.200.150:11211</value>
</list>
</property>
<property name= "Weights" >
<list>
<value>1</value>
</list>
</property>
</bean>
</beans>
160530. memcached Cluster (Spring integrated configuration)