Spring data Operation Redis HGETALL

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

I use HashMap to store my objects having multiple fields. I can put all the fields in Redis once using the DefaultRedisMap.putAll() method, but I cannot immediately get the whole object using BoundHashOperations to get each field using the get() method.

I am wondering if there is a way that I can do the same as the HGETALL operation supported in Redis ?

+4
source share
2 answers

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

+2
source

you can use HashOps :: entries () to immediately get all entries (key and value).

+2
source

Source: https://habr.com/ru/post/1487425/


All Articles