P
Peter Morris [Droopy eyes software]
Hi all
Is there any way I can get a notification of when a weak reference is about
to die so that I can decide to keep hold of it for a bit longer?
My scenario is that my framework loads in Stock objects on demand and then
caches them using a WeakReference. These Stock instances are used a lot of
the time in my app so I'd like them to live a while longer. However it is
impossible to know exactly which instances will be used regularly until
runtime, the user may use one once during the day and then not at all for
the rest of it or they may use the same one over and over.
So what I'd like to do is to have my WeakReference for Stock die X minutes
after the last time it was used. In otherwords I want a notification when
it is about to disappear so that I can prolong it for some additional time.
Any ideas?
Thanks
Pete
Is there any way I can get a notification of when a weak reference is about
to die so that I can decide to keep hold of it for a bit longer?
My scenario is that my framework loads in Stock objects on demand and then
caches them using a WeakReference. These Stock instances are used a lot of
the time in my app so I'd like them to live a while longer. However it is
impossible to know exactly which instances will be used regularly until
runtime, the user may use one once during the day and then not at all for
the rest of it or they may use the same one over and over.
So what I'd like to do is to have my WeakReference for Stock die X minutes
after the last time it was used. In otherwords I want a notification when
it is about to disappear so that I can prolong it for some additional time.
Any ideas?
Thanks
Pete