Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

165
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda