diff --git a/src/Middleware/ResponseCaching/ref/Microsoft.AspNetCore.ResponseCaching.netcoreapp3.0.cs b/src/Middleware/ResponseCaching/ref/Microsoft.AspNetCore.ResponseCaching.netcoreapp3.0.cs index bce7929618..1cb8861848 100644 --- a/src/Middleware/ResponseCaching/ref/Microsoft.AspNetCore.ResponseCaching.netcoreapp3.0.cs +++ b/src/Middleware/ResponseCaching/ref/Microsoft.AspNetCore.ResponseCaching.netcoreapp3.0.cs @@ -17,7 +17,7 @@ namespace Microsoft.AspNetCore.ResponseCaching } public partial class ResponseCachingMiddleware { - public ResponseCachingMiddleware(Microsoft.AspNetCore.Http.RequestDelegate next, Microsoft.Extensions.Options.IOptions options, Microsoft.Extensions.Logging.ILoggerFactory loggerFactory, Microsoft.AspNetCore.ResponseCaching.Internal.IResponseCachingPolicyProvider policyProvider, Microsoft.AspNetCore.ResponseCaching.Internal.IResponseCachingKeyProvider keyProvider) { } + public ResponseCachingMiddleware(Microsoft.AspNetCore.Http.RequestDelegate next, Microsoft.Extensions.Options.IOptions options, Microsoft.Extensions.Logging.ILoggerFactory loggerFactory, Microsoft.Extensions.ObjectPool.ObjectPoolProvider poolProvider) { } [System.Diagnostics.DebuggerStepThroughAttribute] public System.Threading.Tasks.Task Invoke(Microsoft.AspNetCore.Http.HttpContext httpContext) { throw null; } } @@ -29,80 +29,6 @@ namespace Microsoft.AspNetCore.ResponseCaching public bool UseCaseSensitivePaths { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } } } -namespace Microsoft.AspNetCore.ResponseCaching.Internal -{ - public partial class CachedResponse : Microsoft.AspNetCore.ResponseCaching.Internal.IResponseCacheEntry - { - public CachedResponse() { } - public System.IO.Stream Body { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - public System.DateTimeOffset Created { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - public Microsoft.AspNetCore.Http.IHeaderDictionary Headers { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - public int StatusCode { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - } - public partial class CachedVaryByRules : Microsoft.AspNetCore.ResponseCaching.Internal.IResponseCacheEntry - { - public CachedVaryByRules() { } - public Microsoft.Extensions.Primitives.StringValues Headers { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - public Microsoft.Extensions.Primitives.StringValues QueryKeys { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - public string VaryByKeyPrefix { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - } - public partial interface IResponseCache - { - Microsoft.AspNetCore.ResponseCaching.Internal.IResponseCacheEntry Get(string key); - System.Threading.Tasks.Task GetAsync(string key); - void Set(string key, Microsoft.AspNetCore.ResponseCaching.Internal.IResponseCacheEntry entry, System.TimeSpan validFor); - System.Threading.Tasks.Task SetAsync(string key, Microsoft.AspNetCore.ResponseCaching.Internal.IResponseCacheEntry entry, System.TimeSpan validFor); - } - public partial interface IResponseCacheEntry - { - } - public partial interface IResponseCachingKeyProvider - { - string CreateBaseKey(Microsoft.AspNetCore.ResponseCaching.Internal.ResponseCachingContext context); - System.Collections.Generic.IEnumerable CreateLookupVaryByKeys(Microsoft.AspNetCore.ResponseCaching.Internal.ResponseCachingContext context); - string CreateStorageVaryByKey(Microsoft.AspNetCore.ResponseCaching.Internal.ResponseCachingContext context); - } - public partial interface IResponseCachingPolicyProvider - { - bool AllowCacheLookup(Microsoft.AspNetCore.ResponseCaching.Internal.ResponseCachingContext context); - bool AllowCacheStorage(Microsoft.AspNetCore.ResponseCaching.Internal.ResponseCachingContext context); - bool AttemptResponseCaching(Microsoft.AspNetCore.ResponseCaching.Internal.ResponseCachingContext context); - bool IsCachedEntryFresh(Microsoft.AspNetCore.ResponseCaching.Internal.ResponseCachingContext context); - bool IsResponseCacheable(Microsoft.AspNetCore.ResponseCaching.Internal.ResponseCachingContext context); - } - public partial class MemoryResponseCache : Microsoft.AspNetCore.ResponseCaching.Internal.IResponseCache - { - public MemoryResponseCache(Microsoft.Extensions.Caching.Memory.IMemoryCache cache) { } - public Microsoft.AspNetCore.ResponseCaching.Internal.IResponseCacheEntry Get(string key) { throw null; } - public System.Threading.Tasks.Task GetAsync(string key) { throw null; } - public void Set(string key, Microsoft.AspNetCore.ResponseCaching.Internal.IResponseCacheEntry entry, System.TimeSpan validFor) { } - public System.Threading.Tasks.Task SetAsync(string key, Microsoft.AspNetCore.ResponseCaching.Internal.IResponseCacheEntry entry, System.TimeSpan validFor) { throw null; } - } - public partial class ResponseCachingContext - { - internal ResponseCachingContext() { } - public System.TimeSpan? CachedEntryAge { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public Microsoft.AspNetCore.ResponseCaching.Internal.CachedVaryByRules CachedVaryByRules { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public Microsoft.AspNetCore.Http.HttpContext HttpContext { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public System.DateTimeOffset? ResponseTime { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - } - public partial class ResponseCachingKeyProvider : Microsoft.AspNetCore.ResponseCaching.Internal.IResponseCachingKeyProvider - { - public ResponseCachingKeyProvider(Microsoft.Extensions.ObjectPool.ObjectPoolProvider poolProvider, Microsoft.Extensions.Options.IOptions options) { } - public string CreateBaseKey(Microsoft.AspNetCore.ResponseCaching.Internal.ResponseCachingContext context) { throw null; } - public System.Collections.Generic.IEnumerable CreateLookupVaryByKeys(Microsoft.AspNetCore.ResponseCaching.Internal.ResponseCachingContext context) { throw null; } - public string CreateStorageVaryByKey(Microsoft.AspNetCore.ResponseCaching.Internal.ResponseCachingContext context) { throw null; } - } - public partial class ResponseCachingPolicyProvider : Microsoft.AspNetCore.ResponseCaching.Internal.IResponseCachingPolicyProvider - { - public ResponseCachingPolicyProvider() { } - public virtual bool AllowCacheLookup(Microsoft.AspNetCore.ResponseCaching.Internal.ResponseCachingContext context) { throw null; } - public virtual bool AllowCacheStorage(Microsoft.AspNetCore.ResponseCaching.Internal.ResponseCachingContext context) { throw null; } - public virtual bool AttemptResponseCaching(Microsoft.AspNetCore.ResponseCaching.Internal.ResponseCachingContext context) { throw null; } - public virtual bool IsCachedEntryFresh(Microsoft.AspNetCore.ResponseCaching.Internal.ResponseCachingContext context) { throw null; } - public virtual bool IsResponseCacheable(Microsoft.AspNetCore.ResponseCaching.Internal.ResponseCachingContext context) { throw null; } - } -} namespace Microsoft.Extensions.DependencyInjection { public static partial class ResponseCachingServicesExtensions diff --git a/src/Middleware/ResponseCaching/src/Internal/CacheEntry/CacheEntryHelpers .cs b/src/Middleware/ResponseCaching/src/Internal/CacheEntry/CacheEntryHelpers .cs index 919e52b3d7..842e56cbf3 100644 --- a/src/Middleware/ResponseCaching/src/Internal/CacheEntry/CacheEntryHelpers .cs +++ b/src/Middleware/ResponseCaching/src/Internal/CacheEntry/CacheEntryHelpers .cs @@ -1,4 +1,4 @@ -// Copyright (c) .NET Foundation. All rights reserved. +// 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.Extensions.Primitives; diff --git a/src/Middleware/ResponseCaching/src/Internal/CacheEntry/CachedResponse.cs b/src/Middleware/ResponseCaching/src/Internal/CacheEntry/CachedResponse.cs index 62734f8039..b7713843a9 100644 --- a/src/Middleware/ResponseCaching/src/Internal/CacheEntry/CachedResponse.cs +++ b/src/Middleware/ResponseCaching/src/Internal/CacheEntry/CachedResponse.cs @@ -1,4 +1,4 @@ -// Copyright (c) .NET Foundation. All rights reserved. +// 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 System; @@ -7,7 +7,7 @@ using Microsoft.AspNetCore.Http; namespace Microsoft.AspNetCore.ResponseCaching.Internal { - public class CachedResponse : IResponseCacheEntry + internal class CachedResponse : IResponseCacheEntry { public DateTimeOffset Created { get; set; } diff --git a/src/Middleware/ResponseCaching/src/Internal/CacheEntry/CachedVaryByRules.cs b/src/Middleware/ResponseCaching/src/Internal/CacheEntry/CachedVaryByRules.cs index d183724628..e9dc67024a 100644 --- a/src/Middleware/ResponseCaching/src/Internal/CacheEntry/CachedVaryByRules.cs +++ b/src/Middleware/ResponseCaching/src/Internal/CacheEntry/CachedVaryByRules.cs @@ -1,11 +1,11 @@ -// Copyright (c) .NET Foundation. All rights reserved. +// 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.Extensions.Primitives; namespace Microsoft.AspNetCore.ResponseCaching.Internal { - public class CachedVaryByRules : IResponseCacheEntry + internal class CachedVaryByRules : IResponseCacheEntry { public string VaryByKeyPrefix { get; set; } diff --git a/src/Middleware/ResponseCaching/src/Internal/Interfaces/IResponseCache.cs b/src/Middleware/ResponseCaching/src/Internal/Interfaces/IResponseCache.cs index f7b6ac82fd..f76c5d7452 100644 --- a/src/Middleware/ResponseCaching/src/Internal/Interfaces/IResponseCache.cs +++ b/src/Middleware/ResponseCaching/src/Internal/Interfaces/IResponseCache.cs @@ -6,7 +6,7 @@ using System.Threading.Tasks; namespace Microsoft.AspNetCore.ResponseCaching.Internal { - public interface IResponseCache + internal interface IResponseCache { /// /// Gets the cached response for the given key, if it exists. diff --git a/src/Middleware/ResponseCaching/src/Internal/Interfaces/IResponseCacheEntry.cs b/src/Middleware/ResponseCaching/src/Internal/Interfaces/IResponseCacheEntry.cs index a8227fe243..c27570b899 100644 --- a/src/Middleware/ResponseCaching/src/Internal/Interfaces/IResponseCacheEntry.cs +++ b/src/Middleware/ResponseCaching/src/Internal/Interfaces/IResponseCacheEntry.cs @@ -3,7 +3,7 @@ namespace Microsoft.AspNetCore.ResponseCaching.Internal { - public interface IResponseCacheEntry + internal interface IResponseCacheEntry { } } diff --git a/src/Middleware/ResponseCaching/src/Internal/Interfaces/IResponseCachingKeyProvider.cs b/src/Middleware/ResponseCaching/src/Internal/Interfaces/IResponseCachingKeyProvider.cs index ac6a20f005..22da5aec00 100644 --- a/src/Middleware/ResponseCaching/src/Internal/Interfaces/IResponseCachingKeyProvider.cs +++ b/src/Middleware/ResponseCaching/src/Internal/Interfaces/IResponseCachingKeyProvider.cs @@ -5,7 +5,7 @@ using System.Collections.Generic; namespace Microsoft.AspNetCore.ResponseCaching.Internal { - public interface IResponseCachingKeyProvider + internal interface IResponseCachingKeyProvider { /// /// Create a base key for a response cache entry. diff --git a/src/Middleware/ResponseCaching/src/Internal/Interfaces/IResponseCachingPolicyProvider.cs b/src/Middleware/ResponseCaching/src/Internal/Interfaces/IResponseCachingPolicyProvider.cs index 51a040098b..8862b74f4c 100644 --- a/src/Middleware/ResponseCaching/src/Internal/Interfaces/IResponseCachingPolicyProvider.cs +++ b/src/Middleware/ResponseCaching/src/Internal/Interfaces/IResponseCachingPolicyProvider.cs @@ -3,7 +3,7 @@ namespace Microsoft.AspNetCore.ResponseCaching.Internal { - public interface IResponseCachingPolicyProvider + internal interface IResponseCachingPolicyProvider { /// /// Determine whether the response caching logic should be attempted for the incoming HTTP request. diff --git a/src/Middleware/ResponseCaching/src/Internal/ISystemClock.cs b/src/Middleware/ResponseCaching/src/Internal/Interfaces/ISystemClock.cs similarity index 100% rename from src/Middleware/ResponseCaching/src/Internal/ISystemClock.cs rename to src/Middleware/ResponseCaching/src/Internal/Interfaces/ISystemClock.cs diff --git a/src/Middleware/ResponseCaching/src/Internal/MemoryResponseCache.cs b/src/Middleware/ResponseCaching/src/Internal/MemoryResponseCache.cs index 0d3235cf5d..10eb67aaa9 100644 --- a/src/Middleware/ResponseCaching/src/Internal/MemoryResponseCache.cs +++ b/src/Middleware/ResponseCaching/src/Internal/MemoryResponseCache.cs @@ -1,4 +1,4 @@ -// Copyright (c) .NET Foundation. All rights reserved. +// 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 System; @@ -7,11 +7,11 @@ using Microsoft.Extensions.Caching.Memory; namespace Microsoft.AspNetCore.ResponseCaching.Internal { - public class MemoryResponseCache : IResponseCache + internal class MemoryResponseCache : IResponseCache { private readonly IMemoryCache _cache; - public MemoryResponseCache(IMemoryCache cache) + internal MemoryResponseCache(IMemoryCache cache) { _cache = cache ?? throw new ArgumentNullException(nameof(cache)); } diff --git a/src/Middleware/ResponseCaching/src/Internal/ResponseCachingContext.cs b/src/Middleware/ResponseCaching/src/Internal/ResponseCachingContext.cs index 2d8c79b11b..e135583d4a 100644 --- a/src/Middleware/ResponseCaching/src/Internal/ResponseCachingContext.cs +++ b/src/Middleware/ResponseCaching/src/Internal/ResponseCachingContext.cs @@ -1,4 +1,4 @@ -// Copyright (c) .NET Foundation. All rights reserved. +// 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 System; @@ -10,7 +10,7 @@ using Microsoft.Net.Http.Headers; namespace Microsoft.AspNetCore.ResponseCaching.Internal { - public class ResponseCachingContext + internal class ResponseCachingContext { private DateTimeOffset? _responseDate; private bool _parsedResponseDate; @@ -33,7 +33,7 @@ namespace Microsoft.AspNetCore.ResponseCaching.Internal public TimeSpan? CachedEntryAge { get; internal set; } - public CachedVaryByRules CachedVaryByRules { get; internal set; } + public CachedVaryByRules CachedVaryByRules { get; set; } internal ILogger Logger { get; } diff --git a/src/Middleware/ResponseCaching/src/Internal/ResponseCachingKeyProvider.cs b/src/Middleware/ResponseCaching/src/Internal/ResponseCachingKeyProvider.cs index 78f329600f..05a0e9a0f4 100644 --- a/src/Middleware/ResponseCaching/src/Internal/ResponseCachingKeyProvider.cs +++ b/src/Middleware/ResponseCaching/src/Internal/ResponseCachingKeyProvider.cs @@ -1,4 +1,4 @@ -// Copyright (c) .NET Foundation. All rights reserved. +// 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 System; @@ -11,7 +11,7 @@ using Microsoft.Extensions.Primitives; namespace Microsoft.AspNetCore.ResponseCaching.Internal { - public class ResponseCachingKeyProvider : IResponseCachingKeyProvider + internal class ResponseCachingKeyProvider : IResponseCachingKeyProvider { // Use the record separator for delimiting components of the cache key to avoid possible collisions private static readonly char KeyDelimiter = '\x1e'; @@ -21,7 +21,7 @@ namespace Microsoft.AspNetCore.ResponseCaching.Internal private readonly ObjectPool _builderPool; private readonly ResponseCachingOptions _options; - public ResponseCachingKeyProvider(ObjectPoolProvider poolProvider, IOptions options) + internal ResponseCachingKeyProvider(ObjectPoolProvider poolProvider, IOptions options) { if (poolProvider == null) { diff --git a/src/Middleware/ResponseCaching/src/Internal/ResponseCachingPolicyProvider.cs b/src/Middleware/ResponseCaching/src/Internal/ResponseCachingPolicyProvider.cs index dc77de80b2..97f074cf00 100644 --- a/src/Middleware/ResponseCaching/src/Internal/ResponseCachingPolicyProvider.cs +++ b/src/Middleware/ResponseCaching/src/Internal/ResponseCachingPolicyProvider.cs @@ -1,4 +1,4 @@ -// Copyright (c) .NET Foundation. All rights reserved. +// 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 System; @@ -8,7 +8,7 @@ using Microsoft.Net.Http.Headers; namespace Microsoft.AspNetCore.ResponseCaching.Internal { - public class ResponseCachingPolicyProvider : IResponseCachingPolicyProvider + internal class ResponseCachingPolicyProvider : IResponseCachingPolicyProvider { public virtual bool AttemptResponseCaching(ResponseCachingContext context) { diff --git a/src/Middleware/ResponseCaching/src/ResponseCachingMiddleware.cs b/src/Middleware/ResponseCaching/src/ResponseCachingMiddleware.cs index d6a744555c..d936729197 100644 --- a/src/Middleware/ResponseCaching/src/ResponseCachingMiddleware.cs +++ b/src/Middleware/ResponseCaching/src/ResponseCachingMiddleware.cs @@ -9,6 +9,7 @@ using Microsoft.AspNetCore.Http.Features; using Microsoft.AspNetCore.ResponseCaching.Internal; using Microsoft.Extensions.Caching.Memory; using Microsoft.Extensions.Logging; +using Microsoft.Extensions.ObjectPool; using Microsoft.Extensions.Options; using Microsoft.Extensions.Primitives; using Microsoft.Net.Http.Headers; @@ -30,17 +31,17 @@ namespace Microsoft.AspNetCore.ResponseCaching RequestDelegate next, IOptions options, ILoggerFactory loggerFactory, - IResponseCachingPolicyProvider policyProvider, - IResponseCachingKeyProvider keyProvider) + ObjectPoolProvider poolProvider) : this( next, options, loggerFactory, - policyProvider, + new ResponseCachingPolicyProvider(), new MemoryResponseCache(new MemoryCache(new MemoryCacheOptions { SizeLimit = options.Value.SizeLimit - })), keyProvider) + })), + new ResponseCachingKeyProvider(poolProvider, options)) { } // for testing diff --git a/src/Middleware/ResponseCaching/src/ResponseCachingServicesExtensions.cs b/src/Middleware/ResponseCaching/src/ResponseCachingServicesExtensions.cs index b29f95910e..eccb641b59 100644 --- a/src/Middleware/ResponseCaching/src/ResponseCachingServicesExtensions.cs +++ b/src/Middleware/ResponseCaching/src/ResponseCachingServicesExtensions.cs @@ -27,8 +27,6 @@ namespace Microsoft.Extensions.DependencyInjection } services.TryAddSingleton(); - services.TryAddSingleton(); - services.TryAddSingleton(); return services; } diff --git a/src/Middleware/WebSockets/samples/EchoApp/Startup.cs b/src/Middleware/WebSockets/samples/EchoApp/Startup.cs index 15d4589acb..f740d921a7 100644 --- a/src/Middleware/WebSockets/samples/EchoApp/Startup.cs +++ b/src/Middleware/WebSockets/samples/EchoApp/Startup.cs @@ -23,7 +23,7 @@ namespace EchoApp } // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. - public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) + public void Configure(IApplicationBuilder app, IWebHostEnvironment env, ILoggerFactory loggerFactory) { if (env.IsDevelopment()) {