Reputation: 2105
How do I store this in Redis?
+------+---------------+ | val1 | val2 | +------+---------------+ | 51 | Urbis orbi | | 77 | Occaecati | | 51 | Ea eligendi | | 77 | Consequasit | | 51 | Hic unde | +------+---------------+
Then, how do I count it in Redis? e.g.
select count() as count from table where val1 = '51';
Upvotes: 0
Views: 88
Reputation: 6267
Each val1
may have multiple val2
related to it. So you can use Redis Lists
where val1
values will be KEY
s and val2
values will be elements in respective list.
Equivalent of insert
query can be
LPUSH val1 val2
Equivalent of select count
query can be
LLEN val1
Upvotes: 1