- 授权协议: Apache
- 开发语言: Java
- 操作系统: 跨平台
- 软件首页: http://git.oschina.net/uncode/uncode-cache
- 软件文档: http://git.oschina.net/uncode/uncode-cache/blob/master/README.md
软件介绍
uncode-cache
基于 redis 和 ehcache 的两级缓存组件,支持spring-boot,使用方便,有管理页面。
功能概述
统一注解支持
可以设置缓存定时自动更新时间
可以缓存预热
可以设置缓存依赖消除
可以添加监听,使用实现命中率、读/写耗时等
spring boot
1. application.peroperties
uncode.cache.redisClusterAddress=127.0.0.1:7000;127.0.0.1:7001;127.0.0.1:7002;127.0.0.1:7003;127.0.0.1:7004;127.0.0.1:7005 uncode.cache.redisPoolMaxIdle= uncode.cache.redisPoolMinIdle = uncode.cache.redisPoolMaxTotal= uncode.cache.redisPoolMaxWaitMillis= uncode.cache.redisClusterTimeout= uncode.cache.redisClusterMaxRedirections= uncode.cache.redisClusterPassword uncode.cache.scanPackage=cn.uncode.cache uncode.cache.useLocal=true uncode.cache.openCacheLog=false uncode.cache.storeRegion=uncode-cache-demo
2. spring boot启动类
@SpringBootApplication
@EnableAspectJAutoProxy
public class Application {
public static void main(String[] agrs){
SpringApplication.run(Application.class,agrs);
}
}spring配置
<bean id="propertyConfigurer" class="cn.uncode.util.config.UncodePropertyPlaceholderConfigurer"> <property name="ignoreResourceNotFound" value="true" /> <property name="locations"> <list> <value>classpath:config.properties</value> </list> </property> </bean> <!-- 设置代理 --> <aop:aspectj-autoproxy proxy-target-class="true"/> <!-- 配置缓存池 --> <bean id="jedisCluster" class="com.ksudi.proxycache.store.redis.JedisClusterFactory" /> <bean id="cache" class="com.ksudi.proxycache.store.redis.RedisStore"> <property name="jedisCluster" ref="jedisCluster" /> </bean> <!-- 配置缓存代理管理器 --> <bean id="proxyCacheManager" class="com.ksudi.proxycache.ConfigCacheManager" init-method="init"> <!-- 注解的扫描路径 --> <property name="scanPackage" value="com.ksudi.star.service"></property> <property name="cache" ref="cache" /> </bean> <!-- 配置aop缓存处理器 --> <bean class="com.ksudi.proxycache.framework.aop.handle.CacheManagerHandle"> <property name="cacheManager" ref="proxyCacheManager" /> </bean>
核心注解
@Cache(
preload = true,//是否需要缓存预热,会在系统启动时自已加载,支持特殊场景
preloadParameters = {"param1", "param2"},//加载方法参数,目前只支持String
expiredTime = 60,//缓存有效时间,单位秒
cleanTimeExpressions = "0 15 10 ? * *",//缓存定时清除时间表达式,如:每天10点15分触发
cacheCleans={//依赖清除bean定义,当该方法被调用时清除当前缓存,可定义多个
@CacheClean(
beanName="couriersService6",//bean名称
methodName="updateCourierPwd"//方法名称
)
}
)
public User getUserById(){...}工具类
可以直接使用cn.uncode.cache.CacheUtils工具类。
管理页面
特别说明
本项目使用了部分开源项目代码,保留了原作者的名称和所有内容,同时向作者致敬。
JSP网站开发典型模块与实例精讲
李振捷 / 电子工业出版社 / 2006-8 / 50.0
本书是典型模块与实例精讲丛书中的一本。 本书讲解了使用JSP开发网站系统的经典模块和工程实例,基本囊括了JSP的重点技术,对这些模块稍加修改就可以直接使用到实际项目中。为了方便本书的读者交流在学习中遇到的问题,特地在本书的服务网站上公布了很多QQ群组,读者只要拥有QQ号码,就可以参与到本书的QQ学习群组中一起讨论学习心得。本书的作者还在一定的时间给读者提供在线答疑服务。一起来看看 《JSP网站开发典型模块与实例精讲》 这本书的介绍吧!
