Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Spring data Redis HGETALL operation

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?

like image 355
user2508067 Avatar asked Jun 21 '13 07:06

user2508067


2 Answers

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

like image 152
Jennifer Hickey Avatar answered Oct 07 '22 20:10

Jennifer Hickey


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

like image 39
Faisal Feroz Avatar answered Oct 07 '22 21:10

Faisal Feroz