Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
property-management
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
chenjunxiong
property-management
Commits
0b2a98d6
Commit
0b2a98d6
authored
Jul 19, 2019
by
zhangdaihao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
redis增加名字空间分开过期时间 #269
parent
7621cad1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
2 deletions
+8
-2
jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/config/RedisConfig.java
+8
-2
No files found.
jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/config/RedisConfig.java
View file @
0b2a98d6
...
...
@@ -25,6 +25,8 @@ import com.fasterxml.jackson.annotation.PropertyAccessor;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
com.fasterxml.jackson.databind.ObjectMapper.DefaultTyping
;
import
static
java
.
util
.
Collections
.
singletonMap
;
@Configuration
@EnableCaching
// 开启缓存支持
public
class
RedisConfig
extends
CachingConfigurerSupport
{
...
...
@@ -83,8 +85,12 @@ public class RedisConfig extends CachingConfigurerSupport {
// 以锁写入的方式创建RedisCacheWriter对象
RedisCacheWriter
writer
=
RedisCacheWriter
.
lockingRedisCacheWriter
(
factory
);
// 创建默认缓存配置对象
RedisCacheConfiguration
config
=
RedisCacheConfiguration
.
defaultCacheConfig
().
entryTtl
(
Duration
.
ofHours
(
3
));
//设置缓存默认有效期3小时;
RedisCacheManager
cacheManager
=
new
RedisCacheManager
(
writer
,
config
);
/* 默认配置,设置缓存有效期 1小时*/
RedisCacheConfiguration
defaultCacheConfig
=
RedisCacheConfiguration
.
defaultCacheConfig
().
entryTtl
(
Duration
.
ofHours
(
1
)).
disableCachingNullValues
();
/* 配置test的超时时间为120s*/
RedisCacheManager
cacheManager
=
RedisCacheManager
.
builder
(
RedisCacheWriter
.
lockingRedisCacheWriter
(
lettuceConnectionFactory
)).
cacheDefaults
(
defaultCacheConfig
)
.
withInitialCacheConfigurations
(
singletonMap
(
"test"
,
RedisCacheConfiguration
.
defaultCacheConfig
().
entryTtl
(
Duration
.
ofMinutes
(
120
)).
disableCachingNullValues
()))
.
transactionAware
().
build
();
return
cacheManager
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment