• Facebook
  • Twitter
  • Youtube
  • LinedIn
  • RSS
  • Docs
  • Comparisons
  • Blogs
  • Download
  • Contact Us
Download
Show / Hide Table of Contents

ASP.NET Core Output Cache with NCache

ASP.NET Core Output Cache is a middleware-based response caching feature introduced by Microsoft in ASP.NET Core to improve application performance by storing complete HTTP responses for cacheable requests. When subsequent identical requests are received, the cached response is returned directly without executing the application pipeline again.

By default, Output Cache stores responses in the local memory of each application server. The middleware generates cache entries using request information such as routes, query parameters, headers, and configured cache policies. In multi-server deployments, a distributed cache store such as NCache can be configured to share cached responses across all application servers.

Note

This feature is supported only in the NCache OpenSource edition.

Important

Output Cache is supported in NCache OSS 5.3.6.2 and later.

Key Features

The key features of ASP.NET Core Output Cache are as follows:

  • Full Response Caching: Stores the complete serialized HTTP response so that future matching requests can be served directly from cache without reprocessing the request.

  • Improved Application Performance: Reduces controller execution, database calls, and rendering overhead by bypassing the application pipeline for cached requests.

  • Flexible Cache Policies: Supports configurable cache profiles, expiration policies, request variation rules, and custom caching behavior.

  • Request Variation Support: Allows separate cache entries to be created based on routes, query parameters, headers, or custom rules.

  • Tag-Based Eviction: Supports grouping multiple cache entries using tags so that related responses can be invalidated simultaneously.

  • Distributed Cache Support: Supports distributed cache stores such as NCache, allowing cached responses to be shared across multiple application servers.

How Output Cache Works with NCache

ASP.NET Core Output Cache supports distributed cache providers through the Microsoft.AspNetCore.OutputCaching.IOutputCacheStore interface. NCache implements this interface to provide a distributed backing store for Output Cache middleware. When NCache is configured as the Output Cache store, cached HTTP responses are shared across all application servers, allowing subsequent requests on any node to retrieve the cached response directly from the distributed cache.

Response Generation (Write Operation)

When a request is processed for the first time:

  • The request passes through the ASP.NET Core application pipeline.
  • The application generates the HTTP response.
  • Output Cache middleware determines whether the response is cacheable according to the configured policies.
  • A cache key is generated using request information such as route values, query parameters, headers, and variation rules.
  • The serialized HTTP response is then stored in NCache through the IOutputCacheStore implementation.
  • The cached response becomes available to all application servers connected to the same NCache cluster.

Subsequent Requests (Read Operation)

For subsequent matching requests:

  • Output Cache middleware generates the cache key for the incoming request.
  • NCache is queried for the cached response entry.
  • If a matching entry exists, the cached response is returned immediately.
  • The application pipeline, controller execution, and downstream processing are bypassed.
  • If no matching entry exists, the request is processed normally and the generated response is stored again.

This distributed caching architecture reduces redundant request processing across servers, improves response consistency in load-balanced deployments, and supports centralized tag-based invalidation across the cluster.

Note

Cache key generation, cacheability checks, expiration handling, and cache policies are managed by the ASP.NET Core Output Cache middleware. NCache is responsible for storing, retrieving, and removing cached response entries.

In This Section

NCache as Output Cache Provider
Learn how to configure NCache as the distributed Output Cache provider in an ASP.NET Core application.

Contact Us

PHONE

+1 214-619-2601   (US)

+44 20 7993 8327   (UK)

 
EMAIL

sales@alachisoft.com

support@alachisoft.com

NCache
  • Edition Comparison
  • NCache Architecture
  • Benchmarks
Download
Pricing
Try Playground

Deployments
  • Cloud (SaaS & Software)
  • On-Premises
  • Kubernetes
  • Docker
Technical Use Cases
  • ASP.NET Sessions
  • ASP.NET Core Sessions
  • Pub/Sub Messaging
  • Real-Time ASP.NET SignalR
  • Internet of Things (IoT)
  • NoSQL Database
  • Stream Processing
  • Microservices
Resources
  • Magazine Articles
  • Third-Party Articles
  • Articles
  • Videos
  • Whitepapers
  • Shows
  • Talks
  • Blogs
  • Docs
Customer Case Studies
  • Testimonials
  • Customers
Support
  • Schedule a Demo
  • Forum (Google Groups)
  • Tips
Company
  • Leadership
  • Partners
  • News
  • Events
  • Careers
Contact Us

  • EnglishChinese (Simplified)FrenchGermanItalianJapaneseKoreanPortugueseSpanish

  • Contact Us
  •  
  • Sitemap
  •  
  • Terms of Use
  •  
  • Privacy Policy
© Copyright Alachisoft 2002 - . All rights reserved. NCache is a registered trademark of Diyatech Corp.
Back to top