Springmvc integrated memcached property description

SpringMVC integrates memcachedDemo source code download address:

http://download.csdn.net/download/zwl18210851801/10240895

applicationContext.xml configuration:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:aop="http://www.springframework.org/schema/aop"
       xmlns:context="http://www.springframework.org/schema/context"
       xmlns:tx="http://www.springframework.org/schema/tx"
       xmlns:task="http://www.springframework.org/schema/task"
       xmlns:jpa="http://www.springframework.org/schema/data/jpa"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:mongo="http://www.springframework.org/schema/data/mongo"
       xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-4.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/tx 
http://www.springframework.org/schema/tx/spring-tx-4.0.xsd
http://www.springframework.org/schema/task
http://www.springframework.org/schema/task/spring-task-4.0.xsd
http://www.springframework.org/schema/data/mongo
http://www.springframework.org/schema/data/mongo/spring-mongo.xsd
http://www.springframework.org/schema/data/jpa
http://www.springframework.org/schema/data/jpa/spring-jpa.xsd">


    <context:property-placeholder location="classpath:db.properties" /> 
    <context:spring-configured/>
    <context:component-scan base-package="com.memcache.*">
        <context:exclude-filter expression="org.springframework.stereotype.Controller" type="annotation"/>
    </context:component-scan>
    <!-- 配置业务数据MEMCACHED缓存 -->
    <bean id="originalMemcachedClient" class="net.spy.memcached.spring.MemcachedClientFactoryBean">
        <property name="servers" value="${cache.common.ussd.ip.port}"/>
        <property name="protocol" value="TEXT"/>
        <property name="transcoder">
            <bean class="net.spy.memcached.transcoders.SerializingTranscoder">
                <property name="compressionThreshold" value="1024"/>
            </bean>
        </property>
        <property name="opTimeout" value="1000"/>
        <property name="timeoutExceptionThreshold" value="1998"/>
        <property name="locatorType" value="CONSISTENT"/>
        <property name="failureMode" value="Redistribute"/>
        <property name="useNagleAlgorithm" value="false"/>
    </bean> 
    

</beans>


Property description:

Servers A string including host or IP address and port number separated
by space or
comma HashAlg sets the hash algorithm (see the value of net.spy.memcached.HashAlgorithm) InitialObservers sets the observer of the initial connection (observes the initial connection) LocatorType sets the locator type (ARRAY_MOD, CONSISTENT), the default is ARRAY_MOD MaxReconnectDelay sets the maximum connection delay OpFact Set the operation factory OpQueueFactory Set the operation queue factory OpTimeout Set the default operation timeout in milliseconds Protocol specifies the protocol to use (BINARY, TEXT), the default is TEXT ReadBufferSize Sets the read buffer size ReadOpQueueFactory sets the read queue factory ShouldOptimize Operation optimization is not desirable, set to false (defaults to true) Transcoder


























Set the default transcoder (net.spy.memcached.transcoders.SerializingTranscoder by default)
UseNagleAlgorithm
if you want to use the Nagle algorithm, set to true
WriteOpQueueFactory
Set the write queue factory
AuthDescriptor

Set up authDescriptor, use authentication on new connections

timeoutExceptionThreshold

Set the maximum number of timeouts to 1998

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325757114&siteId=291194637