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

How will you load dynamic assembly? How will create assesblies at run time?

925


In your ASP.NET 2.0 web application you want to display an image that is selected from a collection of images. What approach will you use to implementing this?

985


How can we Validate a Controls in ASP.NET page using JavaScript?

1178


How to implement globalization and localization in the use interface in .net.

999


Which two new properties are added in asp.net 4.0 page class?

923


Explain the purpose of storyboard.targetproperty.

943


What is the difference between ldap and active directory?

1072


Explain the significance of routing? : asp.net mvc

1047


What is difference between session and cookies in asp net?

1055


How do session tokens work?

942


What is the difference between the asp and asp.net?

975


What are the two properties that are common on every validation control?

1024


How to include silver light .xap page into asp.net web application and what is the purpose of using silverlight application?

2691


Is asp.net web forms dead?

1103


How would you implement inheritance using c#?

997