Caching
Caching
Caching
NET
By
SRIRAM. B
Objective
Caching Concepts Cache Profiles
Types of Caching Cache Dependency
Page Output Caching File Dependency
Concepts
SQL Cache Dependency
SQL Cache Dependency Configuration
SQL Cache Dependency Attribute
Caching Concepts
Caching Concepts
It is used to retain the pages or data access HTTP requests and reuse them without
the expense of re-creating them.
It is used to catch the entire page.The next time that any user requests the
same page the page is retrieved from the cache.
Partial Caching
Data Caching
Caching the database objects and any other data and use them in multiple
ASP.NET Pages.
DataSouce Caching
* -> Causes a new cached version of the page to be created whenever there is
a change in query string or form parameter passed to the page.
The VaryByHeader attribute to create different cached versions of a page when the
value of a particular browser header changes. The browser headers are transmitted
with each page request, including Accept-Language, User-Agent, Cookie
Used when we want to cache the whole page but also need some dynamic region
inside the cached page is known as Post Cache Substitution.
There two ways to implement the Post Cache Substitution
Response.Write Substitution
Substitution Control
User Controls with Substitution
Container Page
Data Source Caching
SDS Cache Dependency
Data Caching
Data Caching
The existence of the object should be checked before retrieving the data from the
cache:
myValue = Cache["mykey"];
if(myValue != null ) {
DisplayData(myValue);
}
Data Caching..
Expiration allows programmers to give cache items lifetimes, which can be explicit
(for example, expire at 6:00) or can be relative to an item's last use. After an item
has expired, it is removed from the cache and future attempts to retrieve it return
the null value unless the item is reinserted into the cache.
SQL Cache Dependency
SQL Cache Dependency Configuration
SQL Dependency Attribute
Cache Profiles
Cache Profiles
Cache configuration is used to cache the profiles in web.config system and then
use those profiles in multiple asp.net pages.
Cache Profiles allows cache setting for hundreds of page to be displayed and
managed centrally from configuration.
Cache Dependency
Cache Dependency
Cache dependencies allow the validity of a cache item to be based on an external
file or on another cache item. If a dependency changes, the cache item is
invalidated and removed from the cache.
File Dependency
Cache item depend on the external file
Key Dependency
Cache item depend on the another cache item
SQLCache Dependency
Dependent on the database item
Page Cache File Dependency
Data Cache Dependency
Page Cache Dependency
Cascaded Dependency
Cache Life Time
Cache Life Time
Absolute Expiration
You can specify the actual time period after which the cached item will be
removed from the memory.
Sliding Expiration
You specify the time period after which the cached time will be removed from
the memory after it is last accessed
Absolute and Sliding Expiration
Cache Event
Cache Event Handling
Cache Item Removed Callback
Cache Item Removed Callback..
SQL Cache Invalidation
Enables you to make the cache item dependent on the entry in the database, so
the cache entry will be only cleared when the data in the database is changed.