Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

How to implement caching?

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


Please Help Members By Posting Answers For Below Questions

What are the cookies types in asp.net?

964


5. What three Specific Job Positions do you target from Swatz Oils GROUP U.K?

2154


From which base class all web forms are inherited?

923


Explain asp.net mvc request life cycle? : asp.net mvc

977


What are main return types supported in Web API?

1324


What is the use of web.config and machine.config files?

1086


What kind of programming language is ASP.NET?

1081


What is the difference between equals() and == in c#?

941


Define web services in asp.net.

995


How do you declare static variable? What is its lifetime?

914


Can the validation occurs in server-side or client-side? If the validation occurs why should we do?

993


How you can add an event handler?

918


What is dynamic web page with example?

907


How should I destroy my objects in asp.net?

1021


What is the biggest disadvantage of “Other Return Types” in Web API?

1370