Skip to content

Commit 4155afe

Browse files
author
曾梓健
committed
基于redis实现缓存
1 parent 3c2afa5 commit 4155afe

File tree

4 files changed

+14
-3
lines changed

4 files changed

+14
-3
lines changed

springboot_cache/pom.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@
3333
<version>3.0.0</version>
3434
</dependency>
3535

36+
<dependency>
37+
<groupId>org.springframework.boot</groupId>
38+
<artifactId>spring-boot-starter-data-redis</artifactId>
39+
</dependency>
40+
3641
<dependency>
3742
<groupId>com.mysql</groupId>
3843
<artifactId>mysql-connector-j</artifactId>

springboot_cache/src/main/java/com/hand/springboot_cache/entity/Department.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
package com.hand.springboot_cache.entity;
22

3+
import java.io.Serializable;
4+
35
/**
46
* @author zijian.zeng@hand-china.com
57
* @since 2023-02-01
68
*/
7-
public class Department {
9+
public class Department implements Serializable {
810

911
private int id;
1012
private String departmentName;

springboot_cache/src/main/java/com/hand/springboot_cache/entity/Employee.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
package com.hand.springboot_cache.entity;
22

3+
import java.io.Serializable;
4+
35
/**
46
* @author zijian.zeng@hand-china.com
57
* @since 2023-02-01
68
*/
7-
public class Employee {
9+
public class Employee implements Serializable {
810

911
private int id;
1012
private String lastName;

springboot_cache/src/main/resources/application.properties

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,6 @@ spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
66
# 开启驼峰命名
77
mybatis.configuration.map-underscore-to-camel-case=true
88
# 调整日志级别为 debug
9-
logging.level.com.hand.springboot_cache.mapper=debug
9+
logging.level.com.hand.springboot_cache.mapper=debug
10+
11+
spring.redis.host=127.0.0.1

0 commit comments

Comments
 (0)