Answer the question
In order to leave comments, you need to log in
Storing table of active orders in radish?
Hello.
There are orders that are active for 30 minutes to 4 hours.
There are already 500,000 orders in the database today.
The server is directly accessed 1000 requests per minute
Basically the request is, are there any new orders for me?
There are always about 300-500 orders online . I
use Laravel
Now all queries go directly to Mysql, but in fact, why load the database with such frequent queries? Here I want to use Redis for this.
In general, it handles this kind of flow just fine, but I mostly use it as a key=>value.
Redis still has other data types, so I actually wanted to know how to make a list of 300 lines with unique keys.
i.e. even if it’s elementary, it would be possible just to drive an array of all active orders into one key orders and everything is fine, but the question arises, in order to remove 1 order from the array, you need to sort through it all and write back a new array without this order. Likewise with additions.
Is it possible to simply add to the array with 1 command and delete the same by key, plus get the entire list if necessary. It will also be a plus, a selection according to the criteria
Answer the question
In order to leave comments, you need to log in
But we recently took a radish and poheril a good half of the keys. Just took it at night and fucked it up. Randomly different keys. This is the first time in 5 years that we have done this. Backup - yes, there is, but this is already a loss of consistency. After this incident, I cut myself on the nose that I store there only those data that are permissible to lose or can be restored without much loss.
Redis has HSET/HGET/HDEL commands .
They are perfect for this task.
There is a possibility to "add to the array with 1 command and delete by the same key, plus get the whole list if necessary".
If there are requests to the database by key, then such a number does not particularly load it. But with radish, the idea is also OK, but not a cool performance gain.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question