I have googled to try and find an answer to this issue, but everything I
found
beats around the bush.
I have a web service that calls a DLL. In the DLL, I want to cache the small
table
data into server cache rather than hit the DB each time, since the data does
not
change for at least a day.
My question is, will this cache still be there when the web service is
invoked
again? Or does the cache only last as long as the web service (and DLL) is
instantiated?
Here is a snippet of the code:
try {
ds = (DataSet)HttpRuntime.Cache.Get("AVMPolicies");
} catch (Exception ex) {
strErrMsg += ex.Message;
throw new Exception(strErrMsg);
}
....
if (ds == null) {
//cache gone, get from DB
try {
//ORACLE
ds = OraRules.GetPoliciesDB();
//OTHER
//...
} catch (Exception ex) {
//bubbled
throw new Exception(ex.Message);
}
....
//store in cache
try {
HttpRuntime.Cache.Add("AVMPolicies",ds,null,DateTi me.Now.AddMinutes(intTimeout),TimeSpan.Zero,CacheI temPriority.High,null);
} catch (Exception ex) {
strErrMsg += ex.Message;
throw new Exception(strErrMsg);
}
....
================================================== ====================
intTimeout is 15.
Thanks,
Bob