Frequently Asked Interview Questions

How do you retrieve the value of a cache item stored in the servers memory?

How do you retrieve the value of a cache item stored in the servers memory?

You can retrieve the value of a cache item stored in the servers memory through the item’s key, just as you do with the Application and Session objects. Because cached items might be removed from memory, you should always check for their existence before attempting to retrieve their value


private void Button1_Click(object sender, EventArgs e)
{
if (Cache["ChachedItem"] == null)
{
Lable1.Text = "Cached Item not found.";
}
else
{
Lable1.Text = Cache["ChachedItem"].ToString();
}
}


Caching FAQSASP.NET Caching Article


Most Visited Pages

Home | Site Index | Contact Us