Event if object is dropped out of the cache

  • Thread starter Thread starter Steffen Loringer
  • Start date Start date
S

Steffen Loringer

Hi All,

my application is storing some data from a file in the application
cache. The data in the cache is deleted if the original file is changed.
Because the point in time when this happens is unknown to me it would be
helpful to have an event etc. if this happens.
This should be used to load the modified data into the application
cache! Is there a good solution for this problem??

Thanks for your advice and hints

Steffen
 
You don't need to know the point in time at which the object is removed. All
you need to know is that it is no longer there, which can be done by
checking to see if it is null.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
I get paid good money to
solve puzzles for a living
 
And that moment I like to reload the data into the cache again. Without
any interaction. How can this be done?
 
You can use a callback to run code when the cache expires.

Take a look at the overloaded method of Cahce.Insert that passes a delegate.

Not sure if the code run the instant the cache item expires, or when the
application next runs and "sees" that it expired...

HTH,
Greg
 
And that moment I like to reload the data into the cache again. Without
any interaction. How can this be done?

If it isn't there, put it there. One way to do this is to use a Property
that returns the value from the Cache. The get method first checks to see if
the data is cached. If it is null, it refreshes the Cache, and then returns
the data. If not, it simply returns the data.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
I get paid good money to
solve puzzles for a living
 
Back
Top