关于redis的依赖

关于redis的依赖

在项目中出现过好多个关于redis的依赖,他们有什么不同吗?怎么判断什么时候用哪个呢?

<dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-redis</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.session</groupId>
            <artifactId>spring-session-data-redis</artifactId>
        </dependency>
 <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-cache</artifactId>
        </dependency>
        <dependency>
            <groupId>org.redisson</groupId>
            <artifactId>redisson</artifactId>
            <version>3.13.6</version>
        </dependency>

正在回答

登陆购买课程后可参与讨论,去登陆

1回答

同学你好,它们之间的不同点在于它们的功能和用途略有不同。以下是它们的作用和区别: 

1.spring-boot-starter-data-redis: 这个依赖项是SpringBoot中的一个启动器(starter),用于在应用程序启动时加载Redis 数据源。它提供了一个RedisTemplate,用于在应用程序中映射Redis键值对。

2.spring-session-data-redis: 这个依赖项也是SpringBoot中的一个启动器,用于在应用程序启动时加载Redis 会话数据源。它与上面那个启动器类似,但是它支持使用SpringSession,可以用于在应用程序中管理会话。 

3.org.springframework.boot: 这个依赖项是SpringBoot的主依赖项,它提供了SpringBoot 的核心功能。它包含了许多启动器,用于在应用程序启动时加载各种依赖项。

4.org.redisson: 这个依赖项是Redisson库的依赖项它提供了一个高性能的Redis服务器。它是用于Redis集群和分布式锁等场景的。 

祝学习愉快~

问题已解决,确定采纳
还有疑问,暂不采纳

恭喜解决一个难题,获得1积分~

来为老师/同学的回答评分吧

0 星
请稍等 ...
意见反馈 帮助中心 APP下载
官方微信

在线咨询

领取优惠

免费试听

领取大纲

扫描二维码,添加
你的专属老师