gaohan 发表于 2015-11-18 13:19:40

memcached之java客户端:spymemcached与spring整合

memcached之java客户端:spymemcached与spring整合---------net.spy.memcached.spring.MemcachedClientFactoryBean在net.spy.memcached.MemcachedClient每次使用的时候创建MemcachedClient的新实例。<bean id=&quot;memcachedClient&quot; class=&quot;net.spy.memcached.spring.MemcachedClientFactoryBean&quot;>      <property name=&quot;servers&quot; value=&quot;host1:11211,host2:11211,host3:11211&quot;/>      <property name=&quot;protocol&quot; value=&quot;BINARY&quot;/>      <property name=&quot;transcoder&quot;>      <bean class=&quot;net.spy.memcached.transcoders.SerializingTranscoder&quot;>          <property name=&quot;compressionThreshold&quot; value=&quot;1024&quot;/>      </bean>      </property>      <property name=&quot;opTimeout&quot; value=&quot;1000&quot;/>      <property name=&quot;timeoutExceptionThreshold&quot; value=&quot;1998&quot;/>      <property name=&quot;hashAlg&quot; value=&quot;KETAMA_HASH&quot;/>      <property name=&quot;locatorType&quot; value=&quot;CONSISTENT&quot;/>       <property name=&quot;failureMode&quot; value=&quot;Redistribute&quot;/>      <property name=&quot;useNagleAlgorithm&quot; value=&quot;false&quot;/>    </bean>
属性说明:Servers一个字符串,包括由空格或逗号分隔的主机或IP地址与端口号Daemon设置IO线程的守护进程(默认为true)状态FailureMode设置故障模式(取消,重新分配,重试),默认是重新分配HashAlg设置哈希算法(见net.spy.memcached.HashAlgorithm的值)InitialObservers设置初始连接的观察者(观察初始连接)LocatorType设置定位器类型(ARRAY_MOD,CONSISTENT),默认是ARRAY_MODMaxReconnectDelay设置最大的连接延迟OpFact设置操作工厂OpQueueFactory设置操作队列工厂OpTimeout以毫秒为单位设置默认的操作超时时间Protocol指定要使用的协议(BINARY,TEXT),默认是TEXTReadBufferSize设置读取的缓冲区大小ReadOpQueueFactory设置读队列工厂ShouldOptimize如果默认操作优化是不可取的,设置为false(默认为true)Transcoder设置默认的转码器(默认以net.spy.memcached.transcoders.SerializingTranscoder)UseNagleAlgorithm如果你想使用Nagle算法,设置为trueWriteOpQueueFactory设置写队列工厂AuthDescriptor设置authDescriptor,在新的连接上使用身份验证
页: [1]
查看完整版本: memcached之java客户端:spymemcached与spring整合