1

I'm saving a JSON.stringified version of an object to a Redis List. I need to use lists because I'm using LPUSH / RPUSH and LTRIM.

The problem is that node_redis is saving a escaped version of my stringified object, so when I retrieve the list range I can't parse the whole list, I have to iterate trough the list and parse each of the items in the list.

Is there a way to parse the whole list when retrieving it without iterating the whole list?

1 Answer 1

1

Lists are typically always required to iterate over. It's part of the definition.

Can you store your json-object as a String in Redis instead?

Sign up to request clarification or add additional context in comments.

3 Comments

It's stored as a string using JSON.stringify(obj)
I didn't explain myself I guess, I'm still using lists but storing the object as a string in my list. Since I have a bunch of objects I need lists.
You should probably not store the data itself in the list, instead use is as an index, lists are typically used for queues, timelines and messaging. Have you IDs in the list and point to the data elsewhere.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.