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 are the Types of authentications in IIS
while developing webservices if i want some users to use my webservice only how can i give security to my webservice?
What is asp.net mvc? : asp.net mvc
Can the validation occurs in server-side or client-side? If the validation occurs why should we do?
Which methods validate all the controls on a page?
What is the difference between CLICK and MOUSE DOWN Event ?
What is _dopostback in asp net?
what is meant by sitemapnode ?
What is fulltrust?
Define what is razor? : asp.net mvc
Explain how can you debug your .net application?
Explain the difference between webfarm and webgardens in .net?
What is the function of new view engine in asp.net? : asp.net mvc
Where session id is stored?
Explain how cookies work.