M
M
MrOnatsky2018-07-11 02:22:36
PHP
MrOnatsky, 2018-07-11 02:22:36

How to make a selection in Redis?

Good day! Can you tell me how to make a selection in Redis?
There are several values ​​with these keys: "notice:id:12", "notice:id:15", "notice:id:77". And you need to pull out all the values ​​in "notice: id: ...". So say in this section. Is it possible to do this at all? I found a solution, but even I doubt it. Here: And then by the keys I get what I need. Here's how to implement it correctly? Thanks in advance!
$keys = $Redis->scan($it, 'notice:id:*');

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Tikhonov, 2018-07-11
@tumbler

Your method is absolutely correct with absolutely inappropriate storage method :)
I would make a HASH "notices:by_id" in which the keys would be the id of the objects, and the values ​​would be what you want to pull out.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question