SpringBoot redis配置及測試的方法

2022-09-26 12:06:24 字數 2733 閱讀 9509

2.1學過redis的同學都知道這個東西有集群版也有單機版,無論哪個版本配置起來都很簡單

2.1.1首先找到配置檔案

2.1.2然後配置集群版,直接在配置檔案內編輯即可

2.1.3配置單機版

找到測試資料夾,自動注入redis模板

4.1操作string

@test

public void teststring() }效果

. ____ _ __ _ _

/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \

( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \

\\/ ___)| |_)| | | | | || (_| | ) ) ) )

' |____| .__|_| |_|_| |_\__, | / / / /

*****====|_|**********====|___/=/_/_/_/

:: spring boot :: (v2.0.3.release)

2018-06-21 0程式設計客棧9:45:31.328 info 8848 --- [ main] io.lettuce.core.kqueueprovider : starting without optional kqueue library

長安****************************************

福特汽車

88888

88長安

4.2測試hash資料

@test

public void testhash()}效果

. ____ _ __ _ _

/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \

( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \

\\/ ___)| |_)| | | | | || (_| | ) ) ) )

' |____| .__|_| |_|_| |_\__, | / / / /

*****====|_|**********====|___/=/_/_/_/

:: spring boot :: (v2.0.3.release)

2018-06-21 09:48:26.020 info 3852 --- [ main] c.b.s.springbootredisapplicationtests : starting springbootredisapplicationtests on sixfly with pid 3852 (started by administrator in d:\work_space\springbootdemo\springboot-redis)

2018-06-21 09:48:26.030 info 3852 --- [ main] c.b.s.springbootredisapplicationtests : no active profile set, falling back to default profiles: default

2018-06-21 09:48:26.174 info 3852 --- [ main] s.c.a.annotationconfigapplicationcontext : refreshing org.springframework.context.annotation.annotationconfigapplicationcontext@2f953efd: startup date [thu jun 21 09:48:26 cst 2018]; root of context hierarchy

2018-06-21 09:48:28.398 info 3852 --- [ main] .s.d.r.c.repositoryconfigurationdelegate : multiple spring data modules found, entering strict repository configuration mode!

2018-06-21 09:48:32.182 info 3852 --- [ main] o.s.s.concurrent.threadpooltaskexecutor : initializing executorservice

201lbyuo8-06-21 09:48:35.054 info 3852 --- [ main] c.b.s.springbootredisapplicationtests : started springbootredisapplicationtests in 11.637 seconds (jvm running for 19.635)

2018-06-21 09:48:36.390 info 3852 --- [ main] io.lettuce.core.epollprovider : starting without optional epoll library

2018-06-21 09:48:36.398 info 3852 --- [ main] io.lettuce.core.kqueueprovider : starting without optional kqueue library

112018-06-21

888888

Spring Boot Redis 資料快取

之前都是在spring mvc中使用redis,這裡記錄在spring boot中使用redis作為資料快取的過程。參考spring boot整合spring data jpa,搭建專案。本次是在docker中部署redis,從中直接pull官方的redis映象,啟動redis。使用redisdes...

spring boot redis發布訂閱

1.pom 依賴 org.springframework.boot spring boot starter data redis redis.clients jedis 2.配置 redis host 10.5.6.13 port 6379 password sensetime timeout 10...

Spring Boot Redis集群案例

1 配置redis配置檔案 port 6379 daemonize yes bind是繫結ip,0.0.0.0是代表任何ip bind 0.0.0.0 保護模式 protected mode no 新增節點 cluster enabled yes cluster配置檔名,該檔案屬於自動生成,僅用於快...