applicationContext-memcached.xml 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  3. xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd"
  4. xmlns:p="http://www.springframework.org/schema/p"
  5. default-lazy-init="true">
  6. <bean id="xMemcachedClient" class="com.team.cache.memcached.XMemcachedClient" >
  7. <property name="memcachedClient" ref="memcachedClient">
  8. </property>
  9. </bean>
  10. <bean
  11. id="memcachedClientBuilder"
  12. class="net.rubyeye.xmemcached.XMemcachedClientBuilder"
  13. p:connectionPoolSize="${memcached.connectionPoolSize}"
  14. p:failureMode="${memcached.failureMode}">
  15. <constructor-arg>
  16. <list>
  17. <bean class="java.net.InetSocketAddress">
  18. <constructor-arg>
  19. <value>${memcached.server1.host}</value>
  20. </constructor-arg>
  21. <constructor-arg>
  22. <value>${memcached.server1.port}</value>
  23. </constructor-arg>
  24. </bean>
  25. </list>
  26. </constructor-arg>
  27. <constructor-arg>
  28. <list>
  29. <value>${memcached.server1.weight}</value>
  30. </list>
  31. </constructor-arg>
  32. <property name="commandFactory">
  33. <bean class="net.rubyeye.xmemcached.command.TextCommandFactory" />
  34. </property>
  35. <property name="sessionLocator">
  36. <bean class="net.rubyeye.xmemcached.impl.KetamaMemcachedSessionLocator" />
  37. </property>
  38. <property name="transcoder">
  39. <bean class="net.rubyeye.xmemcached.transcoders.SerializingTranscoder" />
  40. </property>
  41. </bean>
  42. <!-- Use factory bean to build memcached client -->
  43. <bean
  44. id="memcachedClient"
  45. factory-bean="memcachedClientBuilder"
  46. factory-method="build"
  47. destroy-method="shutdown" />
  48. </beans>