Skip to content
This repository was archived by the owner on Nov 22, 2018. It is now read-only.

[WIP] pool StringBuilder with ObjectPool #19

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

using Microsoft.AspNetCore.Http;

namespace Microsoft.AspNetCore.ResponseCaching
{
public interface IResponseCachingCacheKeySuffixProvider
{
/// <summary>
/// Create a key segment that is appended to the default cache key.
/// </summary>
/// <param name="httpContext">The <see cref="HttpContext"/>.</param>
/// <returns>The key segment that will be appended to the default cache key.</returns>
string CreateCustomKeySuffix(HttpContext httpContext);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

using Microsoft.AspNetCore.Http;

namespace Microsoft.AspNetCore.ResponseCaching
{
public interface IResponseCachingCacheabilityValidator
{
/// <summary>
/// Override default behavior for determining cacheability of an HTTP request.
/// </summary>
/// <param name="httpContext">The <see cref="HttpContext"/>.</param>
/// <returns>The <see cref="OverrideResult"/>.</returns>
OverrideResult RequestIsCacheableOverride(HttpContext httpContext);

/// <summary>
/// Override default behavior for determining cacheability of an HTTP response.
/// </summary>
/// <param name="httpContext">The <see cref="HttpContext"/>.</param>
/// <returns>The <see cref="OverrideResult"/>.</returns>
OverrideResult ResponseIsCacheableOverride(HttpContext httpContext);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

using Microsoft.AspNetCore.Http;

namespace Microsoft.AspNetCore.ResponseCaching.Internal
{
internal class NoopCacheKeySuffixProvider : IResponseCachingCacheKeySuffixProvider
{
public string CreateCustomKeySuffix(HttpContext httpContext) => null;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

using Microsoft.AspNetCore.Http;

namespace Microsoft.AspNetCore.ResponseCaching.Internal
{
internal class NoopCacheabilityValidator : IResponseCachingCacheabilityValidator
{
public OverrideResult RequestIsCacheableOverride(HttpContext httpContext) => OverrideResult.UseDefaultLogic;

public OverrideResult ResponseIsCacheableOverride(HttpContext httpContext) => OverrideResult.UseDefaultLogic;
}
}
23 changes: 23 additions & 0 deletions src/Microsoft.AspNetCore.ResponseCaching/OverrideResult.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

namespace Microsoft.AspNetCore.ResponseCaching
{
public enum OverrideResult
{
/// <summary>
/// Use the default logic for determining cacheability.
/// </summary>
UseDefaultLogic,

/// <summary>
/// Ignore default logic and do not cache.
/// </summary>
DoNotCache,

/// <summary>
/// Ignore default logic and cache.
/// </summary>
Cache
}
}
Loading