spring-simple-memcache - ReadThroughSingleCache的maven依赖项

时间:2012-04-17 23:32:44

标签: spring memcached simple-spring-memcached ssm

有没有人用过spring simple memcached?我无法获得确切的maven依赖项和可用的存储库。 code.google页面(http://code.google.com/p/simple-spring-memcached/)中提到的依赖项提到了其他依赖项,但它不包含Simple-spring-memcache本身的jar。

感谢帮助人员。

2 个答案:

答案 0 :(得分:2)

试试这个:

<dependency>
  <groupId>com.google.code.simple-spring-memcached</groupId>
  <artifactId>simple-spring-memcached</artifactId>
  <version>2.0.0</version>
</dependency>

答案 1 :(得分:1)

对于SSM 2.0.0,您还需要memcached客户端(xmemcached或spymemcached):

<dependency>
    <groupId>com.google.code.simple-spring-memcached</groupId>
    <artifactId>simple-spring-memcached</artifactId>
    <version>2.0.0</version>
</dependency>
<dependency>
    <groupId>com.googlecode.xmemcached</groupId>
    <artifactId>xmemcached</artifactId>
    <version>1.3.5</version>
</dependency> 

并配置与本地memcached服务器的连接:

<beans xmlns="http://www.springframework.org/schema/beans" 
    xmlns:aop="http://www.springframework.org/schema/aop"
    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">

    <import resource="simplesm-context.xml" />
    <aop:aspectj-autoproxy />

    <bean name="defaultMemcachedClient" class="com.google.code.ssm.CacheFactory">
          <property name="cacheClientFactory">
                <bean class="com.google.code.ssm.providers.xmemcached.MemcacheClientFactoryImpl" />
          </property>
          <property name="addressProvider">
                <bean class="com.google.code.ssm.config.DefaultAddressProvider">
                     <property name="address" value="127.0.0.1:11211" />
                </bean>
          </property>
          <property name="configuration">
                <bean class="com.google.code.ssm.providers.CacheConfiguration">
                      <property name="consistentHashing" value="true" />
                </bean>
          </property>
     </bean>
</beans>