gpt4 book ai didi

spring - Spring Boot中如何手动向Redis添加数据并获取缓存数据?

转载 作者:行者123 更新时间:2023-12-02 18:55:29 24 4
gpt4 key购买 nike

我的要求是将一组规则保留在缓存中并检索键和值。由于我是 Redis 新手,我在 Redis 客户端中创建了一个示例规则,如下所示

enter image description here

这个key和value可以通过Spring data redis取吗?

如果可以的话怎么办?我浏览了几个教程,我只看到使用 Redis 模板设置的值并获取相关值?

谢谢大顺。

最佳答案

i went through several tutorials i only see set values using redis template and get the relevant value?

是的,因为我们大多数人都是这样做的:)我真的很喜欢 RedisTemplate。正如他们的文档中所述:

Helper class that simplifies Redis data access code. Performs automatic serialization/deserialization between the given objects and the underlying binary data in the Redis store.

所以我的建议是,按照我在实现整个缓存服务时所做的那样,检查其中一些教程,因为这会让您的生活更轻松。

关于spring - Spring Boot中如何手动向Redis添加数据并获取缓存数据?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59352057/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com