I'm soliciting your input for ideas on implementing a cache.
This is not an ordidanary cache no sir. I have structs, 1 of which is referenced by one of the others. And one is self referencing.
Root <-> obj1 -> obj1
obj1 -> obj2-> ver1
<-> means that each has a pointer to its parent/child.
obj1->obj1 is a self referencing pointer.
Each element of the cache will be modifiable, and I'll take care of the persistence.
I'd like your thoughts on an implementation. One of the goals is to get as much code re-use as possible and be as simple as possible.
1. use malloc for each element of each structure.
2 use malloc to allocate a large array of elements for each type? Problamatic due to reallocation of the array in the event additional items are added.
3. Where to put the referencing logic, in the loading of the cache? Or post load, in otherwords load the cache for simplicity. Then have a "smarter" layer of code that knows how to connect the internal pointers and references ?