Thread: ideas requested for a CACHE.

  1. #1
    Registered User
    Join Date
    Aug 2007
    Posts
    42

    ideas requested for a CACHE.

    Hi all,

    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 ?

    Thanks,
    Ken

  2. #2
    Registered User
    Join Date
    Oct 2001
    Posts
    2,129
    What is the purpose of this cache and what are the structs for?

  3. #3
    Registered User
    Join Date
    Aug 2007
    Posts
    42
    for later retrieval by another part of the code. They have a key of a uint32_t which will be hashed, generall access to the root and obj1 will be by the hash. Access to ver1 will by by as an array or something similar.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. need help with cache simulator!
    By dtogers123 in forum C Programming
    Replies: 3
    Last Post: 04-30-2008, 06:18 PM
  2. Resource manager tree
    By VirtualAce in forum Game Programming
    Replies: 23
    Last Post: 09-07-2007, 10:27 PM
  3. added start menu crashes game
    By avgprogamerjoe in forum Game Programming
    Replies: 6
    Last Post: 08-29-2007, 01:30 PM
  4. cache miss/hit
    By xddxogm3 in forum C++ Programming
    Replies: 3
    Last Post: 05-07-2007, 06:51 PM
  5. Resource ICONs
    By gbaker in forum Windows Programming
    Replies: 4
    Last Post: 12-15-2003, 07:18 AM