SlideShare uma empresa Scribd logo
1 de 15
ASP.NET Caching
Presenter: Vikash Kumar, Mindfire Solutions
Agenda
●
Basics of ASP.NET Caching
●
Types of Caching
●
Output Caching
●
Full Page Caching
●
Partial (Fragment) Caching
●
Application (Object) Caching
●
System.Runtime.Caching
●
Custom cache providers
●
Some other caching techniques
●
Caching consideration
Basics of ASP.NET Caching
●
Caching is a technique to save frequently
used data into into temporary location.
●
Improves application performance.
●
Reduce a lot of server resources at peak
times.
●
Types of Caching
◦ Output Caching
●
Full Page Caching
●
Partial (Fragment caching)
◦ Application (Object) caching
Output Caching
●
Output caching enable to store rendered
HTML.
●
@ OutputCache directive is used to cache.
●
OutputCache attributes:
◦ Duration (time duration in seconds)
◦ VaryByParam (Cache by parameters)
◦ VaryByControl (Cache by controls)
◦ VaryByHeader (Cache by header Ex: User-Agent)
◦ VaryByCustom (GetVaryByCustomString on
Global.asax)
Output Caching...
●
OutputCache attributes:
◦ VaryByContentEncoding ( Ex: text/plain , text/html )
◦ Location
●
Server ( Output is saved under Web server memory )
●
Downstream ( Header is added to response to cache
on proxy server )
●
Client ( Header is added to response to cache on page
level )
●
Any ( Could be stored on any location ) - Default
●
None ( No caching is done )
Fragment Caching
●
Partial-page caching can work through user
control caching and post-cache substitution.
●
A portion of the page get cached.
●
Done through help of user controls or
substitution controls like AdRotator
●
Shared attribute is only available for user
control for sharing cache across multiple
pages.
Application/Object Caching
●
The application cache provides a
programmatic way for you to store arbitrary
data in memory using key/value pairs. Using
the application cache is like using application
state.
●
System.Web.Caching assembly
●
Depends upon HttpContext
●
Functions
◦ Cache.Insert
◦ Cache.Add
System.Runtime.Caching
●
System.Web.Caching.Cache is used with help
of System.Web.dll
●
New API came with .NET 4.0 under
System.Runtime.Caching.dll with
System.Runtime.Caching
●
It could be used in Win Forms, WPF etc
without making reference to System.Web.dll
●
The new API is based on in memory cache.
●
Write once and can be used in different .NET
technologies.
Custom Cache Provider
●
Output Caching are in memory.
●
Functionality came with ASP.NET 4.0
●
Implements OutputCacheProvider.
●
Add(), Get(), Set(), Remove() functions are
available for operation
●
Through custom cache provider cache could
be stored in File system, Cloud, database,
memory.
●
Helpful under scavenging process (removing
of cache when server memory is getting low).
Custom Cache Provider...
●
Output Caching are in memory.
●
Functionality came with ASP.NET 4.0
●
Implements OutputCacheProvider.
●
Add(), Get(), Set(), Remove() functions are
available for operation
●
Through custom cache provider cache could
be stored in File system, Cloud, database,
memory.
●
Helpful under scavenging process (removing
of cache when server memory is getting low).
Cache Provider
Add Get Set Remove
DB Files
Cache Provider
Add Get Set Remove
CloudDB Files
Custom Cache Provider...
Other techniques
●
Profile Caching under web.config to be
consistent with different setting.
●
GlobalOutputCacheProviderName in
Global.asax to change cache providers
according to need.
●
SQLCacheDependency has very limited
support and also depends upon SQL
configuration too.
http://blogs.msdn.com/b/tolong/archive/2007/02/16/sql-cache-dependency.aspx
http://www.codeproject.com/Articles/12335/Using-SqlDependency-for-
data-change-events
Caching Consideration
●
Full page caching: If page contents changes
after certain interval.
●
Fragment caching: Some of page contents
remains static but others are frequently
changes.
●
Object caching: Data is accessed frequently
and takes time to load up.
●
Cache dependency: File, Directory or based
on other cache entries.
●
Sliding or Absolute: Sliding, if data is not
changed frequently.
Question and
Answer
Thank you

Mais conteúdo relacionado

Mais procurados

Reflection in java
Reflection in javaReflection in java
Reflection in java
upen.rockin
 

Mais procurados (20)

Introduction to Spring Boot
Introduction to Spring BootIntroduction to Spring Boot
Introduction to Spring Boot
 
jQuery Ajax
jQuery AjaxjQuery Ajax
jQuery Ajax
 
Introduction to Angularjs
Introduction to AngularjsIntroduction to Angularjs
Introduction to Angularjs
 
Spring Security 5
Spring Security 5Spring Security 5
Spring Security 5
 
Spring Framework
Spring Framework  Spring Framework
Spring Framework
 
JavaScript Promises
JavaScript PromisesJavaScript Promises
JavaScript Promises
 
Asp.net.
Asp.net.Asp.net.
Asp.net.
 
Jsp ppt
Jsp pptJsp ppt
Jsp ppt
 
Spring introduction
Spring introductionSpring introduction
Spring introduction
 
Java I/O
Java I/OJava I/O
Java I/O
 
Authenticating Angular Apps with JWT
Authenticating Angular Apps with JWTAuthenticating Angular Apps with JWT
Authenticating Angular Apps with JWT
 
Spring boot
Spring bootSpring boot
Spring boot
 
Easy Microservices with JHipster - Devoxx BE 2017
Easy Microservices with JHipster - Devoxx BE 2017Easy Microservices with JHipster - Devoxx BE 2017
Easy Microservices with JHipster - Devoxx BE 2017
 
Spring jdbc
Spring jdbcSpring jdbc
Spring jdbc
 
Java Server Pages(jsp)
Java Server Pages(jsp)Java Server Pages(jsp)
Java Server Pages(jsp)
 
Introduction to the Web API
Introduction to the Web APIIntroduction to the Web API
Introduction to the Web API
 
Asynchronous JavaScript & XML (AJAX)
Asynchronous JavaScript & XML (AJAX)Asynchronous JavaScript & XML (AJAX)
Asynchronous JavaScript & XML (AJAX)
 
Introduction to Spring Framework
Introduction to Spring FrameworkIntroduction to Spring Framework
Introduction to Spring Framework
 
PUC SE Day 2019 - SpringBoot
PUC SE Day 2019 - SpringBootPUC SE Day 2019 - SpringBoot
PUC SE Day 2019 - SpringBoot
 
Reflection in java
Reflection in javaReflection in java
Reflection in java
 

Semelhante a Asp.net caching

Intro to XPages for Administrators (DanNotes, November 28, 2012)
Intro to XPages for Administrators (DanNotes, November 28, 2012)Intro to XPages for Administrators (DanNotes, November 28, 2012)
Intro to XPages for Administrators (DanNotes, November 28, 2012)
Per Henrik Lausten
 
Architectures, Frameworks and Infrastructure
Architectures, Frameworks and InfrastructureArchitectures, Frameworks and Infrastructure
Architectures, Frameworks and Infrastructure
harendra_pathak
 

Semelhante a Asp.net caching (20)

Silverstripe at scale - design & architecture for silverstripe applications
Silverstripe at scale - design & architecture for silverstripe applicationsSilverstripe at scale - design & architecture for silverstripe applications
Silverstripe at scale - design & architecture for silverstripe applications
 
Where is my cache architectural patterns for caching microservices by example
Where is my cache architectural patterns for caching microservices by exampleWhere is my cache architectural patterns for caching microservices by example
Where is my cache architectural patterns for caching microservices by example
 
Archivematica Technical Training Diagnostics Guide (September 2018)
Archivematica Technical Training Diagnostics Guide (September 2018)Archivematica Technical Training Diagnostics Guide (September 2018)
Archivematica Technical Training Diagnostics Guide (September 2018)
 
Intro to XPages for Administrators (DanNotes, November 28, 2012)
Intro to XPages for Administrators (DanNotes, November 28, 2012)Intro to XPages for Administrators (DanNotes, November 28, 2012)
Intro to XPages for Administrators (DanNotes, November 28, 2012)
 
Architectural caching patterns for kubernetes
Architectural caching patterns for kubernetesArchitectural caching patterns for kubernetes
Architectural caching patterns for kubernetes
 
High Availability Content Caching with NGINX
High Availability Content Caching with NGINXHigh Availability Content Caching with NGINX
High Availability Content Caching with NGINX
 
PLNOG 4: Leszek Urbański - A modern HTTP accelerator for content providers
PLNOG 4: Leszek Urbański - A modern HTTP accelerator for content providersPLNOG 4: Leszek Urbański - A modern HTTP accelerator for content providers
PLNOG 4: Leszek Urbański - A modern HTTP accelerator for content providers
 
Introduction to rook
Introduction to rookIntroduction to rook
Introduction to rook
 
High Availability Content Caching with NGINX
High Availability Content Caching with NGINXHigh Availability Content Caching with NGINX
High Availability Content Caching with NGINX
 
Varnish - PLNOG 4
Varnish - PLNOG 4Varnish - PLNOG 4
Varnish - PLNOG 4
 
Where is my cache? Architectural patterns for caching microservices by example
Where is my cache? Architectural patterns for caching microservices by exampleWhere is my cache? Architectural patterns for caching microservices by example
Where is my cache? Architectural patterns for caching microservices by example
 
What’s new in cas 4.2
What’s new in cas 4.2 What’s new in cas 4.2
What’s new in cas 4.2
 
The secret life of a dispatcher (Adobe CQ AEM)
The secret life of a dispatcher (Adobe CQ AEM)The secret life of a dispatcher (Adobe CQ AEM)
The secret life of a dispatcher (Adobe CQ AEM)
 
Where is my cache architectural patterns for caching microservices by example
Where is my cache architectural patterns for caching microservices by exampleWhere is my cache architectural patterns for caching microservices by example
Where is my cache architectural patterns for caching microservices by example
 
ASP.NET 4.0 Cache Extensibility
ASP.NET 4.0 Cache ExtensibilityASP.NET 4.0 Cache Extensibility
ASP.NET 4.0 Cache Extensibility
 
Introduction to CloudStack Storage Subsystem
Introduction to CloudStack Storage SubsystemIntroduction to CloudStack Storage Subsystem
Introduction to CloudStack Storage Subsystem
 
Seif_mike_gsoc_2014_cloudstack
Seif_mike_gsoc_2014_cloudstackSeif_mike_gsoc_2014_cloudstack
Seif_mike_gsoc_2014_cloudstack
 
Load testing in Zonky with Gatling
Load testing in Zonky with GatlingLoad testing in Zonky with Gatling
Load testing in Zonky with Gatling
 
Architectures, Frameworks and Infrastructure
Architectures, Frameworks and InfrastructureArchitectures, Frameworks and Infrastructure
Architectures, Frameworks and Infrastructure
 
Crikeycon 2019 Velociraptor Workshop
Crikeycon 2019 Velociraptor WorkshopCrikeycon 2019 Velociraptor Workshop
Crikeycon 2019 Velociraptor Workshop
 

Mais de Mindfire Solutions

Mais de Mindfire Solutions (20)

Physician Search and Review
Physician Search and ReviewPhysician Search and Review
Physician Search and Review
 
diet management app
diet management appdiet management app
diet management app
 
Business Technology Solution
Business Technology SolutionBusiness Technology Solution
Business Technology Solution
 
Remote Health Monitoring
Remote Health MonitoringRemote Health Monitoring
Remote Health Monitoring
 
Influencer Marketing Solution
Influencer Marketing SolutionInfluencer Marketing Solution
Influencer Marketing Solution
 
ELMAH
ELMAHELMAH
ELMAH
 
High Availability of Azure Applications
High Availability of Azure ApplicationsHigh Availability of Azure Applications
High Availability of Azure Applications
 
IOT Hands On
IOT Hands OnIOT Hands On
IOT Hands On
 
Glimpse of Loops Vs Set
Glimpse of Loops Vs SetGlimpse of Loops Vs Set
Glimpse of Loops Vs Set
 
Oracle Sql Developer-Getting Started
Oracle Sql Developer-Getting StartedOracle Sql Developer-Getting Started
Oracle Sql Developer-Getting Started
 
Adaptive Layout In iOS 8
Adaptive Layout In iOS 8Adaptive Layout In iOS 8
Adaptive Layout In iOS 8
 
Introduction to Auto-layout : iOS/Mac
Introduction to Auto-layout : iOS/MacIntroduction to Auto-layout : iOS/Mac
Introduction to Auto-layout : iOS/Mac
 
LINQPad - utility Tool
LINQPad - utility ToolLINQPad - utility Tool
LINQPad - utility Tool
 
Get started with watch kit development
Get started with watch kit developmentGet started with watch kit development
Get started with watch kit development
 
Swift vs Objective-C
Swift vs Objective-CSwift vs Objective-C
Swift vs Objective-C
 
Material Design in Android
Material Design in AndroidMaterial Design in Android
Material Design in Android
 
Introduction to OData
Introduction to ODataIntroduction to OData
Introduction to OData
 
Ext js Part 2- MVC
Ext js Part 2- MVCExt js Part 2- MVC
Ext js Part 2- MVC
 
ExtJs Basic Part-1
ExtJs Basic Part-1ExtJs Basic Part-1
ExtJs Basic Part-1
 
Spring Security Introduction
Spring Security IntroductionSpring Security Introduction
Spring Security Introduction
 

Último

Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Último (20)

Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptx
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 

Asp.net caching

  • 1. ASP.NET Caching Presenter: Vikash Kumar, Mindfire Solutions
  • 2. Agenda ● Basics of ASP.NET Caching ● Types of Caching ● Output Caching ● Full Page Caching ● Partial (Fragment) Caching ● Application (Object) Caching ● System.Runtime.Caching ● Custom cache providers ● Some other caching techniques ● Caching consideration
  • 3. Basics of ASP.NET Caching ● Caching is a technique to save frequently used data into into temporary location. ● Improves application performance. ● Reduce a lot of server resources at peak times. ● Types of Caching ◦ Output Caching ● Full Page Caching ● Partial (Fragment caching) ◦ Application (Object) caching
  • 4. Output Caching ● Output caching enable to store rendered HTML. ● @ OutputCache directive is used to cache. ● OutputCache attributes: ◦ Duration (time duration in seconds) ◦ VaryByParam (Cache by parameters) ◦ VaryByControl (Cache by controls) ◦ VaryByHeader (Cache by header Ex: User-Agent) ◦ VaryByCustom (GetVaryByCustomString on Global.asax)
  • 5. Output Caching... ● OutputCache attributes: ◦ VaryByContentEncoding ( Ex: text/plain , text/html ) ◦ Location ● Server ( Output is saved under Web server memory ) ● Downstream ( Header is added to response to cache on proxy server ) ● Client ( Header is added to response to cache on page level ) ● Any ( Could be stored on any location ) - Default ● None ( No caching is done )
  • 6. Fragment Caching ● Partial-page caching can work through user control caching and post-cache substitution. ● A portion of the page get cached. ● Done through help of user controls or substitution controls like AdRotator ● Shared attribute is only available for user control for sharing cache across multiple pages.
  • 7. Application/Object Caching ● The application cache provides a programmatic way for you to store arbitrary data in memory using key/value pairs. Using the application cache is like using application state. ● System.Web.Caching assembly ● Depends upon HttpContext ● Functions ◦ Cache.Insert ◦ Cache.Add
  • 8. System.Runtime.Caching ● System.Web.Caching.Cache is used with help of System.Web.dll ● New API came with .NET 4.0 under System.Runtime.Caching.dll with System.Runtime.Caching ● It could be used in Win Forms, WPF etc without making reference to System.Web.dll ● The new API is based on in memory cache. ● Write once and can be used in different .NET technologies.
  • 9. Custom Cache Provider ● Output Caching are in memory. ● Functionality came with ASP.NET 4.0 ● Implements OutputCacheProvider. ● Add(), Get(), Set(), Remove() functions are available for operation ● Through custom cache provider cache could be stored in File system, Cloud, database, memory. ● Helpful under scavenging process (removing of cache when server memory is getting low).
  • 10. Custom Cache Provider... ● Output Caching are in memory. ● Functionality came with ASP.NET 4.0 ● Implements OutputCacheProvider. ● Add(), Get(), Set(), Remove() functions are available for operation ● Through custom cache provider cache could be stored in File system, Cloud, database, memory. ● Helpful under scavenging process (removing of cache when server memory is getting low). Cache Provider Add Get Set Remove DB Files
  • 11. Cache Provider Add Get Set Remove CloudDB Files Custom Cache Provider...
  • 12. Other techniques ● Profile Caching under web.config to be consistent with different setting. ● GlobalOutputCacheProviderName in Global.asax to change cache providers according to need. ● SQLCacheDependency has very limited support and also depends upon SQL configuration too. http://blogs.msdn.com/b/tolong/archive/2007/02/16/sql-cache-dependency.aspx http://www.codeproject.com/Articles/12335/Using-SqlDependency-for- data-change-events
  • 13. Caching Consideration ● Full page caching: If page contents changes after certain interval. ● Fragment caching: Some of page contents remains static but others are frequently changes. ● Object caching: Data is accessed frequently and takes time to load up. ● Cache dependency: File, Directory or based on other cache entries. ● Sliding or Absolute: Sliding, if data is not changed frequently.