On 18/01/2007, at 8:12 PM, Tom Benson wrote:
When part of my program requests a data block from the Database, it
requests it by id. I pass my request first to my handling methods
for the lookup dictionary, and if that data block has already been
instantiated the dictionary will return a reference to that single
instance.
This is the bit I don't get about your desired behaviour.
If you were expecting the item to be removed as soon as its ref count
falls to 1, why would there EVER be a value left in the dictionary?
This scheme only works if multiple parts of your program request the
data block at the same time. If that is what you really want, ...
One relatively trivial solution, although it would be nice to have
direct support, is to add your own ref count in your data block
class., incrementing it and decrementing it in the constructor and
destructor.
The data block will also have to have a reference back to the
DataBlockSupplier so it can tell it the ref count has fallen to 1.
I know it seems like you're adding something RB should provide but
really, it's a pretty small amount of work.
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>