4

redis hash 存每个用户个性化列表行吗?

 2 years ago
source link: https://www.v2ex.com/t/813391
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

V2EX  ›  Redis

redis hash 存每个用户个性化列表行吗?

  sytnishizuiai · 10 小时 28 分钟前 · 288 次点击
目前优化一个接口,请假下:

现在项目,有个题目列表,每个题目会根据用户的身高体重年龄有不同文字介绍。
我现在是存 redis hash ,userid=>题目列表 json (加起来 200 字不到),用户登录直接用 userid 取。
用户用到才存入 hash ,30 天过期时间。

用户越多,hash 会越来越大,几十万后 redis 性能压力大吗?

优化的话,想拆分 hash ,一个 hash 存不同题目列表,一个 hash 存用户及上个 hash 关联 id ,这样可以省点空间。
或者不做缓存,其实也就 3 条 sql 。

Recommend

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK