Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8792603
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T23:00:08+00:00 2026-06-13T23:00:08+00:00

In Redis, to store an array of objects we should use hash for the

  • 0

In Redis, to store an array of objects we should use hash for the object and add its key to a list:

HMSET concept:unique_id name "concept"
...
LPUSH concepts concept:unique_id
...

I want to retrieve all hash values (or objects) in the list, but the list contains only hash keys so a two step command is necessary, right? This is how I’m doing in python:

def get_concepts():

    list = r.lrange("concepts", 0, -1)
    pipe = r.pipeline()

    for key in list:
         pipe.hgetall(key)
    pipe.execute()

Is it necessary to iterate and fetch each individual item? Can it be more optimized?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T23:00:09+00:00Added an answer on June 13, 2026 at 11:00 pm

    You can use the SORT command to do this:

    SORT concepts BY nosort GET concept:*->name GET concept:*->some_key
    

    Where * will expand to each item in the list.

    Add LIMIT offset count for pagination.

    Note that you have to enumerate each field in the hash (each field you want to fetch).

    Another option is to use the new (in redis 2.6) EVAL command to execute a Lua script in the redis server, which could do what you are suggesting, but server side.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to use redis with multidimensional array by using HMSET. My array looks
I have been reading that lots of people use Redis or another key-value store/NoSQL
I am trying to use redis and redis-store with rails 3.1; however I seem
I want to store array of hashes in redis , what is best way
Redis (a key-value store) supports lua scripts - it executes the script on the
We use redis to store 'active' information that we need to recall quickly. Do
I am trying to use redis via c++ client in debian environment to store
I'm using redis to store hashes with ~100k records per hash. I want to
I want to use redis cache store (using redis-store gem). It works fine locally
I am using redis to store a list of items in a set. I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.