Redis緩存lettuce更換為Jedis的實現(xiàn)步驟
在springboot中引入spring-boot-starter-data-redis依賴時,默認(rèn)使用的是lettuce,如果不想使用lettuce而是使用Jedis連接池,就需要我們在引入spring-boot-starter-data-redis依賴時做排除lettuce,
操作步驟如下:
1、在ruoyi-common\pom.xml
手動添加jedis
依賴,排除lettuce
。
<!-- redis 緩存操作 --> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-redis</artifactId> <exclusions> <exclusion> <groupId>io.lettuce</groupId> <artifactId>lettuce-core</artifactId> </exclusion> </exclusions> </dependency> <!--jedis連接池--> <dependency> <groupId>redis.clients</groupId> <artifactId>jedis</artifactId> </dependency>
2、在application.yml中替換配置,配置基本同上,只需要將lettuce換成jedis即可。
spring: redis: jedis: pool: # 連接池中的最小空閑連接 min-idle: 0 # 連接池中的最大空閑連接 max-idle: 8 # 連接池的最大數(shù)據(jù)庫連接數(shù) max-active: 8 # #連接池最大阻塞等待時間(使用負(fù)值表示沒有限制) max-wait: -1ms
到此這篇關(guān)于Redis緩存lettuce更換為Jedis的實現(xiàn)步驟的文章就介紹到這了,更多相關(guān)Redis緩存lettuce更換為Jedis內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!
相關(guān)文章
攔截Redis命令導(dǎo)致的Lua腳本執(zhí)行失敗的問題解決
本文主要介紹了攔截Redis命令導(dǎo)致的Lua腳本執(zhí)行失敗的問題解決,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧2023-06-06