Skip to content

Commit

Permalink
Ensure OutputCaching generates a documentation file (#55170)
Browse files Browse the repository at this point in the history
* Ensure OutputCaching generates a documentation file

Seems we aren't shipping any API docs for Output Caching 馃槩 

Ideally we'd backport this to 8.0.x but I'm not sure if the mechanics of servicing support it (ref assembly doc file change only).

* Naively fix doc comment warnings

* Remove unnecessary usings

---------

Co-authored-by: Andrew Casey <andrew.casey@microsoft.com>
  • Loading branch information
DamianEdwards and amcasey committed May 4, 2024
1 parent ba1fd34 commit b0578d0
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
namespace Microsoft.AspNetCore.OutputCaching;

/// <summary>
/// Represents a store for cached responses that uses a <see cref="IBufferWriter{byte}"/> as the target.
/// Represents a store for cached responses that uses a <see cref="IBufferWriter{Byte}"/> as the target.
/// </summary>
public interface IOutputCacheBufferStore : IOutputCacheStore
{
Expand Down
4 changes: 4 additions & 0 deletions src/Middleware/OutputCaching/src/IOutputCachePolicy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,22 @@ public interface IOutputCachePolicy
/// At that point the cache middleware can still be enabled or disabled for the request.
/// </summary>
/// <param name="context">The current request's cache context.</param>
/// <param name="cancellation">The token to monitor for cancellation requests.</param>
ValueTask CacheRequestAsync(OutputCacheContext context, CancellationToken cancellation);

/// <summary>
/// Updates the <see cref="OutputCacheContext"/> before the cached response is used.
/// At that point the freshness of the cached response can be updated.
/// </summary>
/// <param name="context">The current request's cache context.</param>
/// <param name="cancellation">The token to monitor for cancellation requests.</param>
ValueTask ServeFromCacheAsync(OutputCacheContext context, CancellationToken cancellation);

/// <summary>
/// Updates the <see cref="OutputCacheContext"/> before the response is served and can be cached.
/// At that point cacheability of the response can be updated.
/// </summary>
/// <param name="context">The current request's cache context.</param>
/// <param name="cancellation">The token to monitor for cancellation requests.</param>
ValueTask ServeResponseAsync(OutputCacheContext context, CancellationToken cancellation);
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<PropertyGroup>
<Description>ASP.NET Core middleware for caching HTTP responses on the server.</Description>
<TargetFramework>$(DefaultNetCoreTargetFramework)</TargetFramework>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<IsAspNetCoreApp>true</IsAspNetCoreApp>
<IsPackable>false</IsPackable>
<IsTrimmable>true</IsTrimmable>
Expand Down
3 changes: 3 additions & 0 deletions src/Middleware/OutputCaching/src/OutputCacheContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ namespace Microsoft.AspNetCore.OutputCaching;
/// </summary>
public sealed class OutputCacheContext
{
/// <summary>
/// Constructs a new instance of <see cref="OutputCacheContext"/>.
/// </summary>
public OutputCacheContext()
{
}
Expand Down
2 changes: 0 additions & 2 deletions src/Middleware/OutputCaching/src/OutputCacheEntryFormatter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
using System.Collections.Frozen;
using System.Diagnostics;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Primitives;
using Microsoft.Net.Http.Headers;
Expand Down
5 changes: 3 additions & 2 deletions src/Middleware/OutputCaching/src/OutputCachePolicyBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,8 @@ public OutputCachePolicyBuilder SetVaryByQuery(string[] queryKeys)
/// <summary>
/// Adds a policy to vary the cached responses by header.
/// </summary>
/// <param name="headerNames">The header names to vary the cached responses by.</param>
/// <param name="headerName">The header name to vary the cached responses by.</param>
/// <param name="headerNames">Additional header names to vary the cached responses by.</param>
public OutputCachePolicyBuilder SetVaryByHeader(string headerName, params string[] headerNames)
{
ArgumentNullException.ThrowIfNull(headerName);
Expand Down Expand Up @@ -269,7 +270,7 @@ public OutputCachePolicyBuilder Expire(TimeSpan expiration)
/// <summary>
/// Adds a policy to change the request locking strategy.
/// </summary>
/// <param name="lockResponse">Whether the request should be locked.</param>
/// <param name="enabled">Whether the request should be locked.</param>
/// <remarks>When the default policy is used, locking is enabled by default.</remarks>
public OutputCachePolicyBuilder SetLocking(bool enabled) => AddPolicy(enabled ? LockingPolicy.Enabled : LockingPolicy.Disabled);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ public static class OutputCacheConventionBuilderExtensions
/// <summary>
/// Marks an endpoint to be cached using the specified policy builder.
/// </summary>
/// <param name="builder">The <see cref="IEndpointConventionBuilder"/>.</param>
/// <param name="policy">An action on <see cref="OutputCachePolicyBuilder"/>.</param>
public static TBuilder CacheOutput<TBuilder>(this TBuilder builder, Action<OutputCachePolicyBuilder> policy)
where TBuilder : IEndpointConventionBuilder
Expand All @@ -54,6 +55,7 @@ public static TBuilder CacheOutput<TBuilder>(this TBuilder builder, Action<Outpu
/// <summary>
/// Marks an endpoint to be cached using the specified policy builder.
/// </summary>
/// <param name="builder">The <see cref="IEndpointConventionBuilder"/>.</param>
/// <param name="policy">An action on <see cref="OutputCachePolicyBuilder"/>.</param>
/// <param name="excludeDefaultPolicy">Whether to exclude the default policy or not.</param>
public static TBuilder CacheOutput<TBuilder>(this TBuilder builder, Action<OutputCachePolicyBuilder> policy, bool excludeDefaultPolicy) where TBuilder : IEndpointConventionBuilder
Expand Down

0 comments on commit b0578d0

Please sign in to comment.