Answer Posted / darshan
Basically cache is used to store frequently accessed data
into the memory, for faster retrieval.
Cache object is dictionary, it stores data in key=>value
pair combination. There are two ways to store the data into
the cache.
1. Cache.Add(key, value, dependance, absolute expiration,
sliding expiration, priority, onRemoveCallback);
2. Cache["key"] = value;
Note: If you are not working in web project, then you might
need to create instance of cache class, like following.
Cache che = new Cache();
che.Add(....);
che["key"] = value;
-----------------------------------------------------------------------
Example:
using System;
using System.Web.Caching;
namespace cacheExample
{
public class Example
{
public static void Main()
{
Cache ch = new Cache();
ch["name"] = "Anonymous";
console.WriteLine("Hello your name is: {0}",
ch["name"].ToString();
}
}
}
| Is This Answer Correct ? | 1 Yes | 0 No |
Post New Answer View All Answers
What is autopostback in asp net?
How can you handle errors in Web API?
What is tracing? Where is it used?
What is the difference between pathparam and queryparam?
What is session in asp.net?
How can we implement a identity (sql server) call in an asp.net page?
What is full form of asp.net?
which one is more flexibility and reliability and durability asp.net (VS)php which one is best and which one we do nice to create dynamic websites
What are the security types in ASP/ASP.NET? Different Authentication modes?
i want to implement grid view value in paypal site. so how to create this code in asp.net with C#
Which is an advantage of application service providers?
How long do session variables last?
Why select Web API?
Explain about Automatic resource management?
How can we identify that the page is post back in asp net?