0

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

谢谢你们的帮助。

4

2 回答 2

2

试试这个:

<dependency>
  <groupId>com.google.code.simple-spring-memcached</groupId>
  <artifactId>simple-spring-memcached</artifactId>
  <version>2.0.0</version>
</dependency>
于 2012-04-18T18:44:23.120 回答
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>
于 2012-04-18T20:38:37.690 回答