# redis-cache-spring-boot-starter **Repository Path**: itCjb/redis-cache-spring-boot-starter ## Basic Information - **Project Name**: redis-cache-spring-boot-starter - **Description**: redis二级缓存 - **Primary Language**: Java - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 2 - **Forks**: 0 - **Created**: 2020-02-27 - **Last Updated**: 2021-12-28 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # redis-cache-spring-boot-starter #### 介绍 redis实现二级缓存 #### 软件架构 项目需引入如下依赖方可使用: ```java org.springframework.boot spring-boot-autoconfigure 2.1.8.RELEASE provided redis.clients jedis 2.9.1 provided org.springframework.boot spring-boot-starter-aop 2.1.8.RELEASE provided org.springframework.boot spring-boot-starter-data-redis 2.1.8.RELEASE provided ``` #### 使用说明 1. ```java /** * -前缀 */ String key() default "redisCache"; /** * -缓存单位毫米,默认60秒 */ int timeoutMills() default 60000; /** * -默认0代表查询 ,如果设置为1,remove就会起作用 */ int type() default 0; /** * 带上要删除key的前缀,比如此时插入了新数据 会导致缓存脏读, 所以再插入时删除对应的缓存列表 比如执行updateUser等操作 那么此时应该填入findUser/pageuser等. 未填写时会删除库内所有缓存避免脏读 * * @return */ String[] remove() default {"redisCache"}; ``` 2. 将以上注解加入需要使用二级缓存的地方 3. ``` yaml redis.cache.server.host=127.0.0.1 #默认 redis.cache.server.port=6379 #默认 redis.cache.server.password= #默认"" redis.cache.server.database= #默认0 ```