A
A
AlpineMilk2021-03-25 10:43:44
PHP
AlpineMilk, 2021-03-25 10:43:44

What is the best way to use Redis + PHP?

Hello everyone,
I was faced with the task of adding data to the radish along with filtering by this data. I have not worked with radish before, but I know that it works by key - value.
I have a question how to write data:
- there is a list of products for a specific user, which I need to display through
radish Or is it better to cast it as an array?
[user_id.products] = productsor [user_id.products.product_id] = product
What advantages do I see in using option 1 ( [user_id.products] = products):
- To use the filter on the list, it is enough to get all the data at once and already in the code (I use PHP) do filtering and grouping, I think it's better than with the second option ( [user_id.products.product_id] = product) but maybe I'm wrong.
- But for example, if the data has changed, then I see no other way to change the list of products, as after (adding / editing / deleting) an element, you will have to get the entire list of products from the database again and overwrite it.
In the second method ( [user_id.products.product_id] = product):
- When (adding/editing/deleting) an element, it will be enough just to do something with this particular element without affecting the rest.

Can you tell me how best to use it? Perhaps you have a different vision for this.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question