Spring Boot(11)redis基本使用

2021-10-24 07:51:21 字數 948 閱讀 9185

依賴

配置使用

>

>

org.springframework.bootgroupid

>

>

spring-boot-starter-data-redisartifactid

>

dependency

>

>

>

org.apache.commonsgroupid

>

>

commons-pool2artifactid

>

>

2.8.0version

>

dependency

>

2.1 redis配置
spring.redis.database=0

spring.redis.host=localhost

spring.redis.port=6379

#spring.redis.password=

2.2 連線池配置
# 連線池最大連線數(使用負值表示沒有限制) 預設 8

spring.redis.lettuce.pool.max-active=8

# 連線池最大阻塞等待時間(使用負值表示沒有限制) 預設 -1

spring.redis.lettuce.pool.max-wait=-1

# 連線池中的最大空閒連線 預設 8

spring.redis.lettuce.pool.max-idle=8

# 連線池中的最小空閒連線 預設 0

spring.redis.lettuce.pool.min-idle=0

@autowired

private redistemplate redistemplate;

Springboot中hystrix的基本使用

匯入依賴 org.springframework.cloud spring cloud starter netflix hystrix 2.2.3.release feign hystrix enabled true在啟動類上使用紓解標註啟動hystrix enableeurekaclient my...

SpringBoot使用Redis快取

1.配置pom檔案 org.springframework.boot spring boot starter data redis org.springframework.boot spring boot starter cache net.sf.ehcache ehcache 2.修改專案啟動類,...

初學Springboot整合Redis

首先說下這幾天搞springboot整合redis的感受,springboot2.0版本和springboot1.5版本真的是不同,由於現在最新是2.0,但是網上大部分都是1.5版本的,開始也沒注意,所以一直在坑里轉圈,下面是我的微總結 先說springboot1.5.10版本的 1.所需jar包如...