spring+memcache配置方式
2016-01-27 14:08
357 查看
<?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:context="http://www.springframework.org/schema/context"
xmlns:p="http://www.springframework.org/schema/p"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
<!-- http://code.google.com/p/xmemcached/wiki/Spring_Integration -->
<!-- <context:property-placeholder location="memcached.properties" /> -->
<bean
id="memcachedClientBuilder"
class="net.rubyeye.xmemcached.XMemcachedClientBuilder"
p:connectionPoolSize="50"
p:failureMode="false">
<!-- XMemcachedClientBuilder have two arguments.First is server list,and
second is weights array. -->
<constructor-arg>
<list>
<bean class="java.net.InetSocketAddress">
<constructor-arg>
<value>127.0.0.1</value>
</constructor-arg>
<constructor-arg>
<value>11211</value>
</constructor-arg>
</bean>
<!--
<bean class="java.net.InetSocketAddress">
<constructor-arg>
<value>172.16.0.92</value>
</constructor-arg>
<constructor-arg>
<value>11210</value>
</constructor-arg>
</bean>
-->
</list>
</constructor-arg>
<constructor-arg>
<list>
<value>10</value>
<!-- <value>10</value> -->
</list>
</constructor-arg>
<property name="commandFactory">
<bean class="net.rubyeye.xmemcached.command.BinaryCommandFactory" />
</property>
<property name="sessionLocator">
<bean class="net.rubyeye.xmemcached.impl.KetamaMemcachedSessionLocator" />
</property>
<property name="transcoder">
<bean class="net.rubyeye.xmemcached.transcoders.SerializingTranscoder" />
</property>
<property name="bufferAllocator">
<bean class="net.rubyeye.xmemcached.buffer.SimpleBufferAllocator"></bean>
</property>
</bean>
<!-- Use factory bean to build memcached client -->
<bean
id="memcachedClient"
factory-bean="memcachedClientBuilder"
factory-method="build"
destroy-method="shutdown" />
</beans>
相关文章推荐
- Spring_22_基于配置文件的方式来配置 AOP
- Java后台框架篇--Spring配置数据源的三种方式(dbcp,c3p0,jndi)
- springboot整合redis哨兵方式配置
- spring加载配置文件的几种方式
- Spring配置事务的五种方式
- Spring(二)基于注解的方式配置Bean
- Spring事务配置的五种方式
- Spring事务配置的五种方式和spring里面事务的传播属性和事务隔离级别
- Spring事务配置的五种方式
- Spring 中sessionFactory的几种配置方式
- Spring配置文件 在web.xml的几种配置方式
- Spring 事务基于注解方式的配置
- 注解方式配置spring-mvc
- Spring的AOP实现方式—ProxyFactoryBean配置方式实现源码剖析
- Spring中配置Bean的两种方式
- spring aop的使用(注解方式以及基于xml配置方式)
- Spring进阶之路(11)-使用Aspectj切面配置和XML配置文件方式实现切面编程
- Spring事务配置的五种方式
- Spring之——quartz的配置方式(集群与不集群)
- 对Spring事务配置方式的深入研究