開源項目SDK:https://github.com/mingyang66/spring-parent
個人文檔:https://mingyang66.github.io/raccoon-docs/#/
spring-boot-starter-data-redis: 使用傳統的基于阻塞的I/O編程模型,這意味著當你調用Redis操作時,線程將會被阻塞,知道操作完成,這在高并發場景下可能會導致線程資源的良費和響應時間的增加。
spring-boot-starter-data-redis-reactive: 使用響應式編程模型,在響應式編程中,你的操作是異步的,并且基于事件驅動;你可以繼續處理其他的事情,而不必等待Redis操作完成;當Redis操作完成時,結果會被發送到一個回調函數或訂閱者。
上述描述是spring-boot-starter-data-redis只支持阻塞模式,而不支持基于reactive的響應式編程,但是我通過研究源碼及實際操作驗證spring-boot-starter-data-redis是支持基于ractive的響應式編程的,并且spring-boot-starter-data-redis和spring-boot-starter-data-redis-reactive兩個starter啟動器依賴的jar包都是一樣的,都依賴了ractor-core,所以個人認為這兩個啟動器支持的功能都是一樣的,沒有什么具體的區別。
- spring-boot-starter-data-redis包依賴
|——spring-boot-starter-data-redis
| |——lettuce-core
| | |——netty-common
| | |——netty-handler
| | |——netty-transport
| | |——reactor-core
| |——spring-boot-starter
| |——spring-data-redis
- spring-boot-starter-data-redis-reactive包依賴
|——spring-boot-starter-data-redis-reactive
| |——lettuce-core
| |——reactor-core
| |——spring-boot-starter
| |——spring-data-redis