【发布时间】:2020-10-15 06:05:28
【问题描述】:
我对 Redis 很陌生,我不确定我的用例是否适合 Redis。
我需要存储每个公司 ID 的用户列表。
"companyA" : [
{userName: xyz1, experience: 23,skills: [{name: python, score: 10}, ...], profilePicture:...},
{userName: xyz2, experience: 23,skills:[{name: react, score: 10}, ...], profilePicture:...},
{userName: xyz3, experience: 23,skills:[{name: java, score: 10}, ...], profilePicture:...},
{userName: xyz4, experience: 23,skills:[{name: javascript, score: 10}, ...], profilePicture:...},
]
现在我有一个scoringFunction(companyId, skills[]),它需要一个companyID 和一个技能列表。然后,此函数将从 Redis 中检索所有用户并根据给定的技能列表计算分数。
我想知道这是否是 Redis 的相关用例,因为每个公司的用户列表可能会比较大。感觉每次解析这个数组中的对象都会消耗很多内存...
我的两个问题:
- 我应该使用 Redis 吗?如果是的话,是否可以将用户存储为列表?
- 对于这个用例是否有更好的替代方案?
提前致谢!
【问题讨论】:
标签: performance data-structures redis in-memory-database