# spring-boot-redis
**Repository Path**: samsom/spring-boot-redis
## Basic Information
- **Project Name**: spring-boot-redis
- **Description**: No description available
- **Primary Language**: Java
- **License**: Not specified
- **Default Branch**: master
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 0
- **Forks**: 1
- **Created**: 2019-07-07
- **Last Updated**: 2020-12-19
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
# Redis是一个开源的使用ANSI C语言编写、支持网络、可基于内存亦可持久化的日志型、Key-Value数据库。
## 1、引入依赖:
```xml
org.springframework.boot
spring-boot-starter-redis
```
## 2、Redis参数配置:
```properties
# REDIS (RedisProperties)
# Redis数据库索引(默认为0)
spring.redis.database=0
# Redis服务器地址
spring.redis.host=localhost
# Redis服务器连接端口
spring.redis.port=6379
# Redis服务器连接密码(默认为空)
spring.redis.password=
# 连接池最大连接数(使用负值表示没有限制)
spring.redis.pool.max-active=8
# 连接池最大阻塞等待时间(使用负值表示没有限制)
spring.redis.pool.max-wait=-1
# 连接池中的最大空闲连接
spring.redis.pool.max-idle=8
# 连接池中的最小空闲连接
spring.redis.pool.min-idle=0
# 连接超时时间(毫秒)
spring.redis.timeout=0
```
## 3、在Redis中存储对象,以User对象为例:
### 3.1、创建User对象User.class:
```java
public class User implements Serializable {
private String username;
private int age;
//省略getter和setter
}
```
### 3.2、需要自己实现RedisSerializer接口来对传入对象进行序列化和反序列化
```java
public class RedisObjectSerializer implements RedisSerializer