Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
程序员大阳
spring-boot-wikis
提交
9a5aa5d9
S
spring-boot-wikis
项目概览
程序员大阳
/
spring-boot-wikis
通知
71
Star
1
Fork
2
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
S
spring-boot-wikis
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
9a5aa5d9
编写于
5月 28, 2020
作者:
S
studyingpanda
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
chen
上级
ded4646d
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
36 addition
and
10 deletion
+36
-10
spring-boot-cache/pom.xml
spring-boot-cache/pom.xml
+12
-6
spring-boot-cache/src/main/resources/application.properties
spring-boot-cache/src/main/resources/application.properties
+21
-2
spring-boot-cache/src/test/java/com/imooc/springbootcache/SpringBootCacheApplicationTests.java
...mooc/springbootcache/SpringBootCacheApplicationTests.java
+3
-2
未找到文件。
spring-boot-cache/pom.xml
浏览文件 @
9a5aa5d9
...
...
@@ -34,16 +34,22 @@
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-cache
</artifactId>
</dependency>
<!--
Ehcache
依赖 -->
<!--
Redis 相关
依赖 -->
<dependency>
<groupId>
org.ehcache
</groupId>
<artifactId>
ehcache
</artifactId>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-data-redis
</artifactId>
</dependency>
<dependency>
<groupId>
io.lettuce
</groupId>
<artifactId>
lettuce-core
</artifactId>
</dependency>
<!-- cache-api 依赖 -->
<dependency>
<groupId>
javax.cache
</groupId>
<artifactId>
cache-api
</artifactId>
<groupId>
redis.clients
</groupId>
<artifactId>
jedis
</artifactId>
</dependency>
<!-- Ehcache 依赖 <dependency> <groupId>org.ehcache</groupId> <artifactId>ehcache</artifactId>
</dependency> <dependency> <groupId>javax.cache</groupId> <artifactId>cache-api</artifactId>
</dependency> -->
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-test
</artifactId>
...
...
spring-boot-cache/src/main/resources/application.properties
浏览文件 @
9a5aa5d9
spring.cache.jcache.config
=
classpath:ehcache.xml
spring.cache.type
=
jcache
\ No newline at end of file
# ehcache
# spring.cache.jcache.config=classpath:ehcache.xml
# spring.cache.type=jcache
# 过期时间
spring.cache.redis.time-to-live
=
6000s
# Redis库的编号
spring.redis.database
=
0
# Redis实例地址
spring.redis.host
=
127.0.0.1
# Redis实例端口号,默认6379
spring.redis.port
=
6379
# Redis登录密码
spring.redis.password
=
Easy@0122
# Redis连接池最大连接数
spring.redis.jredis.pool.max-active
=
10
# Redis连接池最大空闲连接数
spring.redis.jedis.pool.max-idle
=
10
# Redis连接池最小空闲连接数
spring.redis.jedis.pool.min-idle
=
0
\ No newline at end of file
spring-boot-cache/src/test/java/com/imooc/springbootcache/SpringBootCacheApplicationTests.java
浏览文件 @
9a5aa5d9
...
...
@@ -40,8 +40,9 @@ class SpringBootCacheApplicationTests {
GoodsDo
temp
=
new
GoodsDo
();
temp
.
setId
(
1L
);
temp
.
setName
(
"新的商品"
);
GoodsDo
newGoods
=
goodsService
.
edit
(
temp
);
// 打印缓存内容
goodsService
.
edit
(
temp
);
// 查询并打印已更新的缓存内容
GoodsDo
newGoods
=
goodsService
.
getById
(
1L
);
logger
.
info
(
"new goods id:{} name:{}"
,
newGoods
.
getId
(),
newGoods
.
getName
());
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录