Answer the question
In order to leave comments, you need to log in
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 json
the 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_decode
by category id, change position and json_encode
overwrite back through hset
Option 2: get updated data from the database and also hset
write 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-action
and product-sale,
product-new
write 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 товара', 'пустота');
hkeys
? Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question