NODE_CACHE format should be the standard format for our topic tree. It's a much more simple representation, more amenable to editing and fast searching.
The major issue with NODE_CACHE is that it can't be saved easily--parent, parents, and children all have object references that wind up creating loops.
So, here's how to save/load NODE_CACHE to/from disk. Then, TOPICS just becomes NODE_CACHE['Topic'][""]:
- convert
parent, parents, and children to slugs before streaming to disk
- after loading from disk, convert those slugs into actual object references in a simple loop. Efficient, as lookup in a dict is hashed, so fast.
That's it! Then, editing becomes so easy, to add / edit / delete nodes. No tree structure needed for navigation; just add, setting all properties necessary on the node, and you're done!
NODE_CACHEformat should be the standard format for our topic tree. It's a much more simple representation, more amenable to editing and fast searching.The major issue with
NODE_CACHEis that it can't be saved easily--parent,parents, andchildrenall have object references that wind up creating loops.So, here's how to save/load NODE_CACHE to/from disk. Then,
TOPICSjust becomesNODE_CACHE['Topic'][""]:parent,parents, andchildrento slugs before streaming to diskThat's it! Then, editing becomes so easy, to add / edit / delete nodes. No tree structure needed for navigation; just add, setting all properties necessary on the node, and you're done!