Spring数据Redis HGETALL操作 [英] Spring data Redis HGETALL operation

查看:259
本文介绍了Spring数据Redis HGETALL操作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆