How to store a generic tree in redis

633 views
Skip to first unread message

Xiangrong Fang

unread,
Sep 21, 2014, 10:13:43 AM9/21/14
to redis-db
Hi All,

I have the following generic (i.e. non-binary) tree structure, and would like to know if Redis is suitable for my application:

1) a tree node may have 0 or 1 parent, 1 data field which can store arbitrary length binary data and 0 to N children.

2) In the order of importance, I would like the following operations to be as quickly as possible:
  • get all leaf nodes of the tree
  • given a node get its parent and level-N ancestors, until the root. N can be arbitrary, but typically not larger than 5.
  • given a node, delete it and all its descendants
  • given a node, get all its direct child
  • add a child node to a specified node.
Will Redis capable of the above? Any suggestions please?

Thanks a lot in advance.

Xiangrong

dao luan

unread,
Sep 21, 2014, 12:30:32 PM9/21/14
to redi...@googlegroups.com
You can store the tree in the form of serialization.

Xiangrong Fang

unread,
Sep 21, 2014, 6:11:18 PM9/21/14
to redis-db
In my understanding, serialization means data is no longer accessible, unless as a bunch of bytes, or when it is de-serialized. That's not what I want...

--
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.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages