redis
现在有如下数据
tag:userid:1 js php python html
tag:userid:2 php python
tag:userid:3 html php
..
..
..
如何找出有相同兴趣的 比如 同时包含 python 的 key 如何实现?
redis
现在有如下数据
tag:userid:1 js php python html
tag:userid:2 php python
tag:userid:3 html php
..
..
..
如何找出有相同兴趣的 比如 同时包含 python 的 key 如何实现?
|
1
你这个想高效,只能反向建索引
|
|
2
这种场景用 redis 不合适。
|
|
3
冗余,再建一个 set <python>:[uid1,uid2]
|
|
xujifNov 26, 2015
4
反向索引+1
|
|
knightdfNov 26, 2015
5
查内容,只能反向索引
|
|
6
创建一个只有 python 的 set
新建一个 set 或 zset tag:python user:1 user:2 user:3 redblade 就是用来干这个的, 用 node.js 实现 https://github.com/newghost/redblade |
|
xiamingchongNov 27, 2015
7
上 es 吧
|