Spring数据Redis HGETALL操作 [英] Spring data Redis HGETALL operation
问题描述
我将Redis
用作我的spring Web应用程序的数据存储,并使用Spring Data-Redis
作为我的客户端与Redis
进行交互.
I am using Redis
as data store for my spring web application and using Spring Data-Redis
as my client to interact with Redis
.
我正在使用HashMap
存储一个我的具有多个字段的对象.我可以使用DefaultRedisMap.putAll()
方法一次将所有字段放入Redis
,但是我不能一次获得整个对象,而是使用BoundHashOperations
通过get()
方法获得每个字段.
I am using HashMap
to store one my objects having multiple fields. I am able to put all the fields into Redis
at once using DefaultRedisMap.putAll()
method, but I am not able to get the whole object at once instead using BoundHashOperations
to get each field using get()
method.
我想知道有什么办法可以像Redis
中支持的HGETALL
操作一样吗?
I am wondering is there any way I can do that just like HGETALL
operation supported in Redis
?
推荐答案
DefaultRedisMap.entrySet()或BoundHashOperations.entries()应该一次为您提供所有键和值.
DefaultRedisMap.entrySet() or BoundHashOperations.entries() should give you all the keys and values at once.
这篇关于Spring数据Redis HGETALL操作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!