1. 增加 Redis Starter
2. 在 system-service-app 引入 Redis Starter
This commit is contained in:
parent
49250ebf45
commit
03fde3699b
21
common/mall-spring-boot-starter-redis/pom.xml
Normal file
21
common/mall-spring-boot-starter-redis/pom.xml
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<parent>
|
||||||
|
<artifactId>common</artifactId>
|
||||||
|
<groupId>cn.iocoder.mall</groupId>
|
||||||
|
<version>1.0-SNAPSHOT</version>
|
||||||
|
</parent>
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
<artifactId>mall-spring-boot-starter-redis</artifactId>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.redisson</groupId>
|
||||||
|
<artifactId>redisson-spring-boot-starter</artifactId>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
</project>
|
@ -0,0 +1,71 @@
|
|||||||
|
package cn.iocoder.mall.redis.core;
|
||||||
|
|
||||||
|
import java.time.Duration;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Redis Key 定义类
|
||||||
|
*/
|
||||||
|
public class RedisKeyDefine {
|
||||||
|
|
||||||
|
public enum KeyTypeEnum {
|
||||||
|
|
||||||
|
STRING,
|
||||||
|
LIST,
|
||||||
|
HASH,
|
||||||
|
SET,
|
||||||
|
ZSET,
|
||||||
|
STREAM,
|
||||||
|
PUBSUB;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 过期时间 - 永不过期
|
||||||
|
*/
|
||||||
|
public static final Duration TIMEOUT_FOREVER = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Key 模板
|
||||||
|
*/
|
||||||
|
private final String keyTemplate;
|
||||||
|
/**
|
||||||
|
* Key 类型的枚举
|
||||||
|
*/
|
||||||
|
private final KeyTypeEnum keyType;
|
||||||
|
/**
|
||||||
|
* Value 类型
|
||||||
|
*
|
||||||
|
* 如果是使用分布式锁,设置为 {@link java.util.concurrent.locks.Lock} 类型
|
||||||
|
*/
|
||||||
|
private final Class valueType;
|
||||||
|
/**
|
||||||
|
* 过期时间
|
||||||
|
*
|
||||||
|
* 为空时,表示永不过期 {@link #TIMEOUT_FOREVER}
|
||||||
|
*/
|
||||||
|
private final Duration timeout;
|
||||||
|
|
||||||
|
public RedisKeyDefine(String keyTemplate, KeyTypeEnum keyType, Class valueType, Duration timeout) {
|
||||||
|
this.keyTemplate = keyTemplate;
|
||||||
|
this.keyType = keyType;
|
||||||
|
this.valueType = valueType;
|
||||||
|
this.timeout = timeout;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getKeyTemplate() {
|
||||||
|
return keyTemplate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public KeyTypeEnum getKeyType() {
|
||||||
|
return keyType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Class getValueType() {
|
||||||
|
return valueType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Duration getTimeout() {
|
||||||
|
return timeout;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -25,6 +25,7 @@
|
|||||||
<module>mall-spring-boot-starter-system-error-code</module>
|
<module>mall-spring-boot-starter-system-error-code</module>
|
||||||
<module>mall-spring-boot-starter-rocketmq</module>
|
<module>mall-spring-boot-starter-rocketmq</module>
|
||||||
<module>mall-spring-boot-starter-xxl-job</module>
|
<module>mall-spring-boot-starter-xxl-job</module>
|
||||||
|
<module>mall-spring-boot-starter-redis</module>
|
||||||
</modules>
|
</modules>
|
||||||
|
|
||||||
<dependencyManagement>
|
<dependencyManagement>
|
||||||
|
@ -40,6 +40,7 @@
|
|||||||
<mybatis.version>3.5.4</mybatis.version>
|
<mybatis.version>3.5.4</mybatis.version>
|
||||||
<mybatis-plus.version>3.3.2</mybatis-plus.version>
|
<mybatis-plus.version>3.3.2</mybatis-plus.version>
|
||||||
<spring-boot-starter-data-jest.version>3.2.5.RELEASE</spring-boot-starter-data-jest.version>
|
<spring-boot-starter-data-jest.version>3.2.5.RELEASE</spring-boot-starter-data-jest.version>
|
||||||
|
<redisson.version>3.13.6</redisson.version>
|
||||||
<!-- RPC 相关 -->
|
<!-- RPC 相关 -->
|
||||||
<dubbo.version>2.7.7</dubbo.version>
|
<dubbo.version>2.7.7</dubbo.version>
|
||||||
<!-- MQ 相关 -->
|
<!-- MQ 相关 -->
|
||||||
@ -145,11 +146,22 @@
|
|||||||
<version>${spring-boot-starter-data-jest.version}</version>
|
<version>${spring-boot-starter-data-jest.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.redisson</groupId>
|
||||||
|
<artifactId>redisson-spring-boot-starter</artifactId>
|
||||||
|
<version>${redisson.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>cn.iocoder.mall</groupId>
|
<groupId>cn.iocoder.mall</groupId>
|
||||||
<artifactId>mall-spring-boot-starter-mybatis</artifactId>
|
<artifactId>mall-spring-boot-starter-mybatis</artifactId>
|
||||||
<version>1.0-SNAPSHOT</version>
|
<version>1.0-SNAPSHOT</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>cn.iocoder.mall</groupId>
|
||||||
|
<artifactId>mall-spring-boot-starter-redis</artifactId>
|
||||||
|
<version>1.0-SNAPSHOT</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<!-- Web 相关 -->
|
<!-- Web 相关 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
|
@ -56,6 +56,11 @@
|
|||||||
<artifactId>mall-spring-boot-starter-mybatis</artifactId>
|
<artifactId>mall-spring-boot-starter-mybatis</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>cn.iocoder.mall</groupId>
|
||||||
|
<artifactId>mall-spring-boot-starter-redis</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<!-- 监控相关 -->
|
<!-- 监控相关 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
@ -1,10 +1,11 @@
|
|||||||
spring:
|
spring:
|
||||||
# 数据源配置项
|
# MySQL 配置项
|
||||||
datasource:
|
datasource:
|
||||||
url: jdbc:mysql://400-infra.server.iocoder.cn:3306/mall_system?useSSL=false&useUnicode=true&characterEncoding=UTF-8&serverTimezone=CTT
|
url: jdbc:mysql://400-infra.server.iocoder.cn:3306/mall_system?useSSL=false&useUnicode=true&characterEncoding=UTF-8&serverTimezone=CTT
|
||||||
driver-class-name: com.mysql.jdbc.Driver
|
driver-class-name: com.mysql.jdbc.Driver
|
||||||
username: root
|
username: root
|
||||||
password: 3WLiVUBEwTbvAfsh
|
password: 3WLiVUBEwTbvAfsh
|
||||||
|
|
||||||
# Spring Cloud 配置项
|
# Spring Cloud 配置项
|
||||||
cloud:
|
cloud:
|
||||||
nacos:
|
nacos:
|
||||||
|
@ -1,10 +1,17 @@
|
|||||||
spring:
|
spring:
|
||||||
# 数据源配置项
|
# MySQL 配置项
|
||||||
datasource:
|
datasource:
|
||||||
url: jdbc:mysql://400-infra.server.iocoder.cn:3306/mall_system?useSSL=false&useUnicode=true&characterEncoding=UTF-8&serverTimezone=CTT
|
url: jdbc:mysql://400-infra.server.iocoder.cn:3306/mall_system?useSSL=false&useUnicode=true&characterEncoding=UTF-8&serverTimezone=CTT
|
||||||
driver-class-name: com.mysql.jdbc.Driver
|
driver-class-name: com.mysql.jdbc.Driver
|
||||||
username: root
|
username: root
|
||||||
password: 3WLiVUBEwTbvAfsh
|
password: 3WLiVUBEwTbvAfsh
|
||||||
|
|
||||||
|
# Redis 配置
|
||||||
|
redis:
|
||||||
|
host: 127.0.0.1
|
||||||
|
port: 6379
|
||||||
|
database: 0
|
||||||
|
|
||||||
# Spring Cloud 配置项
|
# Spring Cloud 配置项
|
||||||
cloud:
|
cloud:
|
||||||
nacos:
|
nacos:
|
||||||
|
Loading…
Reference in New Issue
Block a user