Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

164
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda