rvwsd
rvwsd

Reputation: 97

Redis to store large lists

I'm quite new to Redis and I'm not sure if my use case is a good fit for Redis.

I need to store a list of users per company 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:...},
  ]

Now I have a scoringFunction(companyId, skills[]) that takes a companyID and a list of skills. This function will then retrieve all the users from Redis and calculate a score based on the given list of skills.

I was wondering if this is a relevant use case for Redis as the list of users per company can get relatively large. I have the feeling that parsing the objects in this array every time would consume a lot of memory...

My two questions:

Thanks in advance!

Upvotes: 0

Views: 754

Answers (1)

Tuan Anh Tran
Tuan Anh Tran

Reputation: 7267

you can use list data type to store list of users id in a company

eg: company:<id> as key and user:1, user:2, .... as list item.

and then user meta goes to another key user:<id>, could be hash or string

Upvotes: 1

Related Questions