What is the difference between application state and caching?

 Posted by Susanthampy on 5/23/2011 | Category: ASP.NET Interview questions | Views: 13955 | Points: 40
Answer:

Application variable is the global variable specific to application but a caching variable is specific to page and time out. Application variables exist as long as the application is alive. Whereas the cache has the Property of timeout which allows us to control the duration of the Objects so cached.Another usefulness in caching is that we can define the way we cache our output since caching can be done in 3 ways - a) Full Page - defined in page directrive) Partial Page - Eg - .ascx control) Data / Programmatic caching. using the Properties of Cache object such as Cache.Insert .Caching variable is specific to page and time outApplication variable is the global variable specific to application. Application Object and Cached Object both falls under Server side State Management.Application object resides in InProc i.e. on the same server where we hosted our application.Cache Object resides on server side/ DownStream/Client Side.Application Object will be disposed once application will stop.Cache Object can be disposed using Time based cache dependency.Only one user can access Application Object at a time hence we have to lock it every time we modify it.


Source: http://msdn.microsoft.com/en-u | Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response