I am kinda new to what I am trying to do here so maybe someone knows if it is even possible.
I am writing a data access layer that caches a certain amount of objects (to limit database access). I need to find out how many references to the objects in the cache exist as more items are added so I can eliminate objects that are not being used from the cache as the cache reaches its size limit.
Can you even find out how many references to a .net object there are. Am I wasting my time. I am currently using weak refferences to keep the cache a manageable size but from what I understand about them is that I will not be able to use IS to compare my objects now because the ones returned from the cache may be different from the ones referenced elsewhere in the program. I know that the weak refferences make new objects when needed so I am guessing this is the case. I guess I just need to know if you can get a refference count on an object or a better way to limit my cache size while maintaing the ability to us IS for object comparison.
Any help is appreciated.
Beaniiman
I am writing a data access layer that caches a certain amount of objects (to limit database access). I need to find out how many references to the objects in the cache exist as more items are added so I can eliminate objects that are not being used from the cache as the cache reaches its size limit.
Can you even find out how many references to a .net object there are. Am I wasting my time. I am currently using weak refferences to keep the cache a manageable size but from what I understand about them is that I will not be able to use IS to compare my objects now because the ones returned from the cache may be different from the ones referenced elsewhere in the program. I know that the weak refferences make new objects when needed so I am guessing this is the case. I guess I just need to know if you can get a refference count on an object or a better way to limit my cache size while maintaing the ability to us IS for object comparison.
Any help is appreciated.
Beaniiman