0

How many types of cache is there in asp.net and how can implement it ?

2 Answers 2

5

There is 1 Cache object, that you can use more or less like the Application object

And there is Output caching, per page or per user control.

You would use the Cache object like this (there are overloads):

Cache.Insert("myKey", myValue,  null, DateTime.Now.AddMinutes(2),
   System.Web.Caching.Cache.NoSlidingExpiration);

And for outputcaching, you can use this line below the <%@ Page %> line:

 <%@ OutputCache Duration="120" VaryByParam="myParam"%>
Sign up to request clarification or add additional context in comments.

2 Comments

And other forms of State Management can be found here: msdn.microsoft.com/en-us/library/75x4ha6s.aspx
Another overview of persistence, 9 options: msdn.microsoft.com/en-us/magazine/cc300437.aspx#S8
1

You can use the CacheManager http://msdn.microsoft.com/en-us/library/cc467894.aspx from the Enterprise Library or if you want a distributed cache you can go for Memcached http://memcached.org/

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.