要在已经开发好的项目中添加redis缓存
1.引入framework-redis包
2.编写缓存常量类,其中包含缓存前缀,缓存有效时间
3.在springmvc-config.xml中添加配置文件
<aop:aspectj-autoproxy proxy-target-class="true" />
<context:component-scan base-package="cn.bidlink.ebnew">
<context:include-filter type="regex" expression="cn.bidlink.ebnew.*.action.*Action"/>
</context:component-scan>
4.需要添加缓存的查询方法上加入注解
@Cache(key = BidRedisConstants.BIDWEB_BUSINESSSHOW_DETAIL_KEY, expire = BidRedisConstants.BIDWEB_BUSINESSSHOW_DETAIL_EXPIRE)