B
B
Boooom2020-11-15 15:26:03
Redis
Boooom, 2020-11-15 15:26:03

3 questions about working with REDIS?

Hello!

I’m just starting to put radishes into practice, everything seems to be clear, but I still have questions

Question 1
1. There is a hash table with categories (the data of each category is stored in jsonthe format - key - category id)
2. Sorting them on the site, in the method comes with an array of data id категории - позиция категории, which are processed and written to the database through foreach
3. How can this data be updated in radish?

Option 1: get through json_decodeby category id, change position and json_encodeoverwrite back through hset
Option 2: get updated data from the database and also hsetwrite new data
Option 3: does radish have some kind of magic bun that can overwrite data in one action?
Option 4: another correct way

Question 2
1. Each product has an identifier "discount", "promotion", "new"
2. in the hash table, the products are in the format Redis::hset('product, 'id', 'данные');
3. How to get products that have discount and promotion identifiers?

Option 1: Add new hash tables product-actionand product-sale, product-newwrite stock items there
Option 2: Another correct way

Question 3
1. For each category, you need to specify what products it has - how to do this?

Option 1:
Create your own hash table for each category

Redis::hset('id категории', 'id товара', 'пустота');

and deliver by hkeys?
Option 2:
Another correct option?

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