.net cache
1. why use cache
can increase performance by storing memory data that is access frequently and that requires signficant processing time to create.
2. application cache
the application cache provide a programmatic way for you to store arbitaray data in memory using key/value pairs.
3.diifference between application cache and application state
The cache is volatile but the application state is statice, the cache is not stored in memory for the life of application.the cache can be remove when the data is expire or become invalidated, or when the memory runs low.
4.page output cache
stores the contents of a processed asp.net page in memory. use when a page don't change often and require significant processing to create.
two modles: full page cache and partical page cache.
5.automatic data removal
three statements: 1.scavenge 2.expired 3 dependency changed
6 about scavenge
scavenge is the process of deleting items from cache when memory is scarce. Items are delete when they have not been accessed in some time or when items are mark as low priority when add to cache. ASP.NET uses the CacheItemPriority to determine which items to scavenge first.
7.Expiration
we can set expire time for cache when added.there are two types of expiration
a.sliding expiration: specified how long after an item was last accessed that it expires.for example , you can set an item to expire after 20 mins after it was last accessed in the cache.
b.absolute expiration: specified that an item expires at a set time, regardless of how often it accessed. eg. you can set an item to expire at 6:00 pm or after four hours.
8. dependency
configure an item's lifetime in the cache be dependent on other application elements such as files or databases. when the element that a cache item depends on changes, asp.net removes the item from the cache