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

Can we set master page as a start page?

1078


Difference between using directive vs using statement?

1035


What kind of data can be stored in viewstate?

1024


What are the data controls available in asp.net?

1003


Explain what are the advantages of asp.net mvc framework? : asp.net mvc

1182


Explain the advantages of caching?

1062


What are the different web pages?

977


How does a content page differ from a master page?

1100


Explain asp.net page life cycle?

1136


How to retrieve user name in case of Window Authentication?

807


What are asp.net web forms?

1073


What is the difference between CC and BCC?

1116


Explain the procedure to handle the process request using mhpm events fired? : asp.net mvc

1060


Do I need to have the latest version of windows media player installed?

1007


What are validator? Name the validation controls in asp.net?

1059