Spring data Redis HGETALL operation

◇◆丶佛笑我妖孽 提交于 2019-12-06 00:14:01

问题


I am using Redis as data store for my spring web application and using Spring Data-Redis as my client to interact with Redis.

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.

I am wondering is there any way I can do that just like HGETALL operation supported in Redis?


回答1:


DefaultRedisMap.entrySet() or BoundHashOperations.entries() should give you all the keys and values at once.




回答2:


you can use HashOps::entries() to get all the entries (key and value) at once.



来源:https://stackoverflow.com/questions/17230205/spring-data-redis-hgetall-operation

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!