We're using the HttpRuntime Cache for our objects and we're trying to do the following.
We pull lists of objects from the database and put them in cache. We put a reference to the list in cache, but we also put references to the individual items so we can access them without having to search the lists. The objects and lists each have unique identifiers. The issue is when we want to update the object. Lets say we pull an individual object from the database. We need to update the individual reference in cache plus the list reference. We would like to do this without having to find every reference in all of the lists.
For example, we have 4 objects in the database and we pull two lists.
The cache would have the following references.
List1 -> 1,2,3
List2 - > 2,3,4
1
2
3
4
Initially I can access object 3 using the list or directly, and I get a reference to the same object.
Now what can happen is someone will load object 3 from the database individually. I need to update both references without having to look in every list.
This would be fairly easy using pointers directly, but I don't want to get into unsafe code.
Hope this makes sense.