danga memcacheClient与spring结合

<?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:p="http://www.springframework.org/schema/p"
    xmlns:aop="http://www.springframework.org/schema/aop" xmlns:context="http://www.springframework.org/schema/context"
    xmlns:tx="http://www.springframework.org/schema/tx"
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
            http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
            http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
            http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
            ">

    <bean id="memcachedPool" class="com.danga.MemCached.SockIOPool"
        factory-method="getInstance" init-method="initialize" destroy-method="shutDown">
        <constructor-arg>
            <value>neeaMemcachedPool</value>
        </constructor-arg>
        <property name="servers">
            <list>
                <value>${memcache.server}</value>
            </list>
        </property>
        <property name="initConn">
            <value>${memcache.initConn}</value>
        </property>
        <property name="minConn">
            <value>${memcache.minConn}</value>
        </property>
        <property name="maxConn">
            <value>${memcache.maxConn}</value>
        </property>
        <property name="maintSleep">
            <value>${memcache.maintSleep}</value>
        </property>
        <property name="nagle">
            <value>${memcache.nagle}</value>
        </property>
        <property name="socketTO">
            <value>${memcache.socketTO}</value>
        </property>
    </bean>
    <bean id="memcachedClient" class="com.danga.MemCached.MemCachedClient"
        depends-on="memcachedPool">
        <constructor-arg>
            <value>neeaMemcachedPool</value>
        </constructor-arg>
    </bean>
    <bean id="memcache" class="com.jtxw.cache.impl.MemcacheService">
        <property name="client" ref="memcachedClient"></property>
    </bean>
</beans>
memcache.server=127.0.0.1\:11211
memcache.initConn=20
memcache.minConn=10
memcache.maxConn=50
memcache.maintSleep=3000
memcache.nagle=false
memcache.socketTO=3000

 

posted on 2012-12-31 12:24  游鱼  阅读(980)  评论(0编辑  收藏  举报