Add short-circuit to WN (#29979)
parent
32e39bdd20
commit
59e2738662
|
@ -4,7 +4,7 @@ author: rick-anderson
|
|||
description: Learn about the new features in ASP.NET Core 8.0.
|
||||
ms.author: riande
|
||||
ms.custom: mvc
|
||||
ms.date: 07/28/2023
|
||||
ms.date: 08/02/2023
|
||||
uid: aspnetcore-8
|
||||
---
|
||||
# What's new in ASP.NET Core 8.0
|
||||
|
@ -622,6 +622,18 @@ var network = new IPNetwork(IPAddress.Parse("2001:db8:3c4d::1"), 128);
|
|||
|
||||
ASP.NET Core 8 adds support for using Redis as a distributed cache for output caching. Output caching is a feature that enables an app to cache the output of a minimal API endpoint, controller action, or Razor Page. For more information, see [Output caching](xref:performance/caching/output#cache-storage).
|
||||
|
||||
### Short-circuit middleware after routing
|
||||
|
||||
When routing matches an endpoint, it typically lets the rest of the middleware pipeline run before invoking the endpoint logic. Services can reduce resource usage by filtering out known requests early in the pipeline. Use the <xref:Microsoft.AspNetCore.Builder.RouteShortCircuitEndpointConventionBuilderExtensions.ShortCircuit%2A> extension method to cause routing to invoke the endpoint logic immediately and then end the request. For example, a given route might not need to go through authentication or CORS middleware. The following example short-circuits requests that match the `/short-circuit` route:
|
||||
|
||||
:::code language="csharp" source="~/fundamentals/routing/samples/8.x/ShortCircuitSample/Program.cs" id="mapget":::
|
||||
|
||||
Use the <xref:Microsoft.AspNetCore.Routing.RouteShortCircuitEndpointRouteBuilderExtensions.MapShortCircuit%2A> method to set up short-circuiting for multiple routes at once, by passing to it a params array of URL prefixes. For example, browsers and bots often probe servers for well known paths like `robots.txt` and `favicon.ico`. If the app doesn't have those files, one line of code can configure both routes:
|
||||
|
||||
:::code language="csharp" source="~/fundamentals/routing/samples/8.x/ShortCircuitSample/Program.cs" id="mapshortcircuit":::
|
||||
|
||||
For more information, see [Short-circuit middleware after routing](xref:fundamentals/routing#short-circuit-middleware-after-routing).
|
||||
|
||||
<!--
|
||||
## API controllers
|
||||
|
||||
|
|
Loading…
Reference in New Issue