spring集成xmemcached

spring集成xmemcached


<dependency>
            <groupId>com.googlecode.xmemcached</groupId>
            <artifactId>xmemcached</artifactId>
            <version>1.4.1</version>
        </dependency>




<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://www.springframework.org/schema/beans
        http://www.springframework.org/schema/beans/spring-beans-3.2.xsd">
     <!--xmemcached-->
    <bean name="memcachedClientBuilder" class="net.rubyeye.xmemcached.XMemcachedClientBuilder">
        <constructor-arg>
            <list>
                <bean class="java.net.InetSocketAddress">
                    <constructor-arg value="127.0.0.1"/>
                    <constructor-arg value="11211"/>
                </bean>
            </list>
        </constructor-arg>

        <!--config weight-->
        <constructor-arg>
            <array>
                <value>1</value>
                <!--<value>2</value>-->
            </array>
        </constructor-arg>
        <property name="connectionPoolSize" value="10"/>
        <property name="commandFactory">
            <bean class="net.rubyeye.xmemcached.command.TextCommandFactory"/>
        </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="name" value="landlordsServerCached"/>

    </bean>
    <bean name="memcachedClient" factory-bean="memcachedClientBuilder" factory-method="build" destroy-method="shutdown"/>


</beans>


你可能感兴趣的:(spring集成xmemcached)