whats the correct way to cache a object(DataSet) and then get it and when it expires repopulate it with out a major hiccup in the application… the application relies on this data to be there for read only purposes.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I assume your problem is the fact that repopulating it can take some time, and that you’re not really worried about slightly stale data? In that case, you can probably do this:
Obviously, this is just pseudocode, but you should be able to see what’s going on: when the cached value expires, we spin up a new thread to fetch the new value, but while that thread is still working, we continue to serve up the old cached value.
Finally, when the thread has finished it’s work, we replace the old cached value with the new one.