Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/redis/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Tree 如何在redis中实现文件夹层次结构树?_Tree_Redis - Fatal编程技术网

Tree 如何在redis中实现文件夹层次结构树?

Tree 如何在redis中实现文件夹层次结构树?,tree,redis,Tree,Redis,我正在寻找一种在redis中实现分层文件/文件夹树并能够轻松移动节点的有效方法 / a/ a1 a2 b/ b1 b2 c/ c1 x/ x1 y/ y1 我想存储上面的树,并能够轻松地进行以下操作: move node /a/b/c to /foo/a/b/c move node /a/b/c to /x/c delete node /a/b 指

我正在寻找一种在redis中实现分层文件/文件夹树并能够轻松移动节点的有效方法

/
  a/
     a1
     a2
     b/
        b1
        b2
        c/
           c1
  x/
     x1
     y/
        y1
我想存储上面的树,并能够轻松地进行以下操作:

move node /a/b/c to /foo/a/b/c 
move node /a/b/c to /x/c
delete node /a/b

指向现有实现模型等的指针会很有帮助。

我设计的模式可以帮助人们轻松地添加、移动和重命名节点和条目

# **enode** a hierarchical directory in redis
# A folder/node structure where nodes can have sub-nodes and entries. 
# Entries can have tags.
#
# Each entry gets an enodeid and an entryid
# enodeid - The id of the directory that contains the entry
# entryid - The id of this entry within this enode/directory
#
# The data schema is as follows
#   enodeid:kids -  Sorted set containing the kids for each directory
#                   The topmost node is a string "root" and not a number
#                   The sort score is actually the enodeid of the corresponding kid
#                   so if /a has an enodeid of 2 and is a kid of root the entry is
#                   root:kids [2, "a"]
#                   If a directory /a/b exists and has an enodeid of 4 than
#                   2:kids = [4, "b"] - here 2 is the enodeid of '/a'
#
#   enodeid:meta -  Hash entry containing the name and parent of an enodeid
#                   2:meta = {name: "a", parentid: "root"}
#                   4:meta = {name: "b", parentid: 2}
#
#   enode.next.id - Unique enode id's
#
#   entry.next.id - Unique entry id's
#
#   enodeid:entries -   Sorted set containing the entries in a directory
#                       The sort score is the sequence number of the entry withi the directory
#                       moveEntry moves the entry up/down within this
#
#   enodeid.entry.num - Unique entry id's for a given enodeid
#
#   enodeid:tags -  Sorted list of tags
#                   Score is tagcount, memeber is tag
#
#   enodeid:axs -   List of usernames that have access to this folder