Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

155
Views
Redis storing and getting multiple records

I'm quite new to redis and have a task at hand to optimize redis operations for a dashboard of a non-profit.

The scenario:

  • We have multiple cities (London, Rome,...)
  • We have 1000s of users in each city

We have a need to load users from a particular city, and at the moment it is stored by city ID. As you can imagine, this results in a massive document that needs to be re-cached on every small change to the user.

I want to change this methodology so users are stored in Redis in the following format: [cityID][userID]. So if I need to pull all users from london, I can just call IDFORLONDON?

Would this be the correct way to approach it? Is there a way to load only 10 users from IDFORLONDON? (for pagination). Or is my option to load all and then slice?

Thank you!

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

I'm gonna recommend you go with RedisJSON if you can. RedisJSON is a module that you can add to Redis to extend its capabilities—in this case adding JSON documents and a whole host of commands to read, write, and manipulate them.

From the Redis command-line it looks like this:

127.0.0.1:6379> JSON.SET london . '{ "users": [ "alice", "bob", "frank" ]}'
OK
127.0.0.1:6379> JSON.GET london .users
"[\"alice\",\"bob\",\"frank\"]"
127.0.0.1:6379> JSON.ARRAPPEND london .users '"charlie"'
(integer) 4
127.0.0.1:6379> JSON.GET london .users
"[\"alice\",\"bob\",\"frank\",\"charlie\"]"
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!