memcached+spring集成

参见文章

1.下载windows memcached

2.maven设置,下载memcached client java

		<dependency>
			<groupId>com.whalin</groupId>
			<artifactId>Memcached-Java-Client</artifactId>
			<version>3.0.1</version>
			<type>jar</type>
			<scope>compile</scope>
		</dependency>

3.在spring里面设置

	<bean id="memCachedPool" class="com.whalin.MemCached.SockIOPool" factory-method="getInstance" init-method="initialize" destroy-method="shutDown">
		<constructor-arg>
			<value>memCachedPool</value>
		</constructor-arg>
		<property name="servers">
			<list>
				<value>192.168.1.234:11211</value>
			</list>
		</property>
		<property name="initConn">
             <value>20</value>
         </property>
         
         <property name="minConn">
             <value>10</value>
         </property>
 
         <property name="maxConn">
             <value>50</value>
         </property>
 
         <property name="maintSleep">
             <value>3000</value>
         </property>
 
         <property name="nagle">
             <value>false</value>
         </property>
 
         <property name="socketTO">
             <value>3000</value>
         </property>
	</bean>
	<bean id="memCachedClient" class="com.whalin.MemCached.MemCachedClient">
		<constructor-arg>
			<value>memCachedPool</value>
		</constructor-arg>
	</bean>

4.代码里面编写

	private MemCachedClient memCachedClient;



你可能感兴趣的:(java,java,java,spring,spring,memcached,memcached)