Answer the question
In order to leave comments, you need to log in
How to properly partition data in Redis?
So I want to use Redis to pass data between services and for caching.
By default, 16 databases are available in Redis, but I did not quite understand their practical use.
I'll try to explain in detail.
I have some data: (cities, countries, airports, articles, statistics data, etc.).
To store data in Redis, I can use data structures such as hash tables:
Страны HSET id_1 "{объект json}"
Страны HSET id_2 "{объект json}"
Страны HSET id_3 "{объект json}"
HSET airport id_1 "{объект json}"
HSET airport id_2 "{объект json}"
HSET airport id_3 "{объект json}"
HSET record id_1 "{объект json}"
HSET record id_2 "{объект json}"
HSET record id_3 "{объект json}"
select 3
SET id_1 "{объект json}"
SET id_2 "{объект json}"
SET id_3 "{объект json}"
Answer the question
In order to leave comments, you need to log in
In practice, the logical separation is most often used: one database - one "set" of data. For example, sessions can be stored in database 1, background task queues in database 2, and view counters in database 3. This gives certain benefits:
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question