all groups > asp.net caching > april 2005 >
You're in the

asp.net caching

group:

Cache Not Available Problem


Cache Not Available Problem Mathew Uthup
4/28/2005 8:37:12 PM
asp.net caching:
Does any one know Why and When the .Net Runtime Throws the "Cache Not
Available" Exception Message. The Code Snppet That Causes the Problem is as
follows.
The Code..

internal class EnvUtil :System.Web.UI.Page
{
//private string m_sResetClientId;
internal EnvUtil()
{

}
internal string ResetClientID
{
get
{
string sResetClientId="";
try
{
if (Cache["ResetClientDoc"]
== null)
{
TextReader xt=new
StreamReader(Server.MapPath(@"../../Content/EnvReport/ResetClientID.xml"));


sResetClientId=xt.ReadToEnd();
xt.Close();
CacheDependency dep
= new
CacheDependency(Server.MapPath(@"../../Content/EnvReport/ResetClientID.xml"),
DateTime.Now);



Cache.Insert("ResetClientDoc", sResetClientId, dep);

}
else
{

sResetClientId=(string) Cache["ResetClientDoc"];

}

}
catch (Exception ex)
{
Debug.WriteLine(ex.Message);
}

return sResetClientId;
}
}

}
}

======================
Output
?ex.Message
"Cache is not available"
=======================
Re: Cache Not Available Problem Alvin Bruney [MVP - ASP.NET]
5/4/2005 12:00:00 AM
does it always throw this exception or randomly

--
Regards,
Alvin Bruney - ASP.NET MVP

[Shameless Author Plug]
The Microsoft Office Web Components Black Book with .NET
Now available @ www.lulu.com/owc, Amazon.com etc
[quoted text, click to view]

AddThis Social Bookmark Button