标签:cto 分享 mave ret SM artifact version def service
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>
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>
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 }
标签:cto 分享 mave ret SM artifact version def service
原文地址:https://www.cnblogs.com/xiaobin-hlj80/p/8977854.html