Re: Does redis support rdbm like catalog?

28 views
Skip to first unread message

Josiah Carlson

unread,
May 20, 2013, 12:53:28 PM5/20/13
to redi...@googlegroups.com
You have three choices:
1. You can encode your data in hash fields as you've described
2. You can encode your field names in your keys, which then are used for your nested structures - e.g. instead of trying to store a list of email addresses as: user:<id> -> {emails -> [list of emails], ...} you would store them as: user:<id>:emails -> [list of emails]
3. For values in your hash, you could use a semantic like "a null character prefix says that the value is stored in another key", which you would then use as: user:<id> -> {emails -> '\0external-key'}, external-key -> [list of emails]

Which one to use? If you are only ever writing once, but need to send the data to other clients (like in JSON format), then just store the data as an attribute like in #1, and ship your data straight without decoding it. If you need to fetch all of your data at the same time (again with few writes), and your client doesn't support pipelining, then that would suggest that #1 is still the right answer. But if you are changing your data regularly, can use pipelining, or need to fetch a subset of the data (instead of all of it) - that would suggest that you should use #2.

Regards,
 - Josiah



On Fri, May 17, 2013 at 11:19 AM, <yli...@gmail.com> wrote:
Hi,

Basically we have multiple clients and we want each client's data to sit in its own unique catalog for easy maintenance like delete. I thought of using set/hset with client id as part of the key and store value as field1 v1 field2 v2... However, the value of v1 or v2 for field is NOT a string. The values itself again is a set or a list. It seems Redis does not support nested list/set. Then I have to store the value as json or serialized object. This certainly will work but will reduce performance for both get and set operations. What's the best way to get this done?

Mark

--
You received this message because you are subscribed to the Google Groups "Redis DB" group.
To unsubscribe from this group and stop receiving emails from it, send an email to redis-db+u...@googlegroups.com.
To post to this group, send email to redi...@googlegroups.com.
Visit this group at http://groups.google.com/group/redis-db?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Reply all
Reply to author
Forward
0 new messages