P
P
Pavel Talaiko2020-02-01 15:27:56
Java
Pavel Talaiko, 2020-02-01 15:27:56

How to search for recorded entities in SpringTemplateRadis?

Hello.
Decided to use Redis. A lot of data is in Redis. I do not want to load all saved entities. How to make a query on the fields of a saved entity?
Entities of type:
[
{
"id": "60fd141f-ad4d-4408-8f77-94552bfe69be",
"title": "values",
"status": "ACTIVE"
}
]

You need to select all entities from redis by ACTIVE status, but not I want to load the entire list into the RAM. What is the best way to make a request on the server side?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Ilya, 2020-02-01
@devpav

The fact is that Redis is a key-value database, that is, it perceives your loaded json simply as a string. In addition, Redis does not support search by value, there is a SCAN command (and similar ones), but they only work for keys.
The best solution for you is to build an additional index based on SORTEDSET or based on HASH, depending on the use case.
https://redis.io/topics/indexes

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question