首页 > 系统服务 > 详细

memcached usage

时间:2018-05-02 01:49:06      阅读:185      评论:0      收藏:0      [点我收藏+]

 

https://github.com/ragnor/simple-spring-memcached/wiki/Getting-Started

 

1) maven

技术分享图片
<dependency>
  <groupId>com.google.code.simple-spring-memcached</groupId>
  <artifactId>spymemcached-provider</artifactId>
  <version>4.0.0</version>
</dependency>
spymemcached

 

2) applicationContext.xml

技术分享图片
<import resource="simplesm-context.xml" />
    <aop:aspectj-autoproxy />
    
    <bean name="defaultMemcachedClient" class="com.google.code.ssm.CacheFactory">
        <property name="cacheClientFactory">
          <bean name="cacheClientFactory" class="com.google.code.ssm.providers.spymemcached.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>
spring config xml(part)

 

3) service

技术分享图片
1     @Override
2     @ReadThroughSingleCache(namespace = "carnum", expiration = 300)
3     public List<TrainOrder> getCarList(String year, String month, @ParameterValueKeyProvider int trainNumber) {
4         // TODO Auto-generated method stub
5         return trainOrderDao.getCarnumberList(year, month, trainNumber);
6     }
TrainOrderServiceImpl.java(part)

 

memcached usage

原文:https://www.cnblogs.com/xiaobin-hlj80/p/8977854.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!