Using redis-rb, how can I push a hash into a list? Do I have to JSON encode it or is this natively supported? If so, how can I do it? I only see hset method with a key and key/value pairs.
Thanks
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
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.
Storing any object (not just hash) as a JSON encoded string is one way to do it.
If your use case allows it you can also store hash IDs within the list and use SORT GET to retrieve additional values.
Example:
To get list names from hashes which IDs are stored within
occupantslist. You can retrieve multiple fields, but you will get only array back.For more information check SORT command