Explain the difference between cache object and application object.
Application Object: Application variable/object stores an Object with a scope of availability of the entire Application unless explicitly destroyed.
Caching Object: The lifetime of cache is throughout the lifetime aof an application or is based upon timeouts
What is Cache Callback in Cache?
The cache object has dependencies e.g. relationships to the file it stores. Cache items remove the object when these dependencies change. As a work around we would need to simply execute a callback method whenever items are removed from the cache to add the items back in cache.
e.g.: We have a string variable string var="hello" and store it in cache. This item would be removed from the cache if value is changed from "hello" to "bye". In such a case we need to simply right a callback function which would add updated var back in cache as it’s been removed as a result of its dependencies changinga
What is Scavenging?
A process where items are removed from cache in order to free the memory based on their priority. A property called "CacheItemPriority" is used to figure out the priority of each item inside the cache. This priority property is set when an item is added to the cache.
Explain the types of Caching using Cache object of ASP.NET.
- Page output: Is used to fetch information or data at page level. It is best used when the site is mainly static. Used by declaring the output page directive
- Page fragment: Is used to cache the structure level information. It is used when parts of pages change. For example: user control
- Programmatic or data: Is used to fetch the information of an application quickly based on the requirements.

0 Comments:
Post a Comment