Skip to content

Commit cf54d00

Browse files
committed
fix PR nits from #48450
1 parent d922af8 commit cf54d00

File tree

5 files changed

+43
-33
lines changed

5 files changed

+43
-33
lines changed

src/Caching/StackExchangeRedis/src/Microsoft.Extensions.Caching.StackExchangeRedis.csproj

+6-2
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,20 @@
1616
<Reference Include="Microsoft.AspNetCore.OutputCaching" Condition="'$(TargetFramework)' != '$(DefaultNetFxTargetFramework)' and '$(TargetFramework)' != 'netstandard2.0'" />
1717
<Reference Include="Microsoft.Extensions.Options" />
1818
<Reference Include="StackExchange.Redis" />
19-
<InternalsVisibleTo Include="Microsoft.Extensions.Caching.StackExchangeRedis.Tests"/>
19+
</ItemGroup>
20+
21+
<ItemGroup>
22+
<InternalsVisibleTo Include="Microsoft.Extensions.Caching.StackExchangeRedis.Tests" />
2023
</ItemGroup>
2124

2225
<ItemGroup>
2326
<Compile Include="$(SharedSourceRoot)ThrowHelpers\ArgumentNullThrowHelper.cs" LinkBase="Shared" />
2427
<Compile Include="$(SharedSourceRoot)ThrowHelpers\ObjectDisposedThrowHelper.cs" LinkBase="Shared" />
2528
<Compile Include="$(SharedSourceRoot)CallerArgument\CallerArgumentExpressionAttribute.cs" LinkBase="Shared" />
29+
</ItemGroup>
2630

31+
<ItemGroup>
2732
<AdditionalFiles Include="PublicAPI/$(TargetFramework)/PublicAPI.Shipped.txt" />
2833
<AdditionalFiles Include="PublicAPI/$(TargetFramework)/PublicAPI.Unshipped.txt" />
2934
</ItemGroup>
30-
3135
</Project>

src/Caching/StackExchangeRedis/src/RedisOutputCacheStore.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -114,14 +114,14 @@ private async Task RunGarbageCollectionLoopAsync()
114114
catch (Exception ex)
115115
{
116116
// this sweep failed; log it
117-
_logger.LogDebug(ex, "Transient error occurred executing redis output-cache GC loop");
117+
_logger.LogWarning(ex, "Transient error occurred executing redis output-cache GC loop");
118118
}
119119
}
120120
}
121121
catch (Exception ex)
122122
{
123123
// the entire loop is dead
124-
_logger.LogDebug(ex, "Fatal error occurred executing redis output-cache GC loop");
124+
_logger.LogError(ex, "Fatal error occurred executing redis output-cache GC loop");
125125
}
126126
}
127127

src/Caching/StackExchangeRedis/src/StackExchangeRedisCacheServiceCollectionExtensions.cs

+2
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ public static IServiceCollection AddStackExchangeRedisOutputCache(this IServiceC
5151

5252
services.Configure(setupAction);
5353
// replace here (Add vs TryAdd) is intentional and part of test conditions
54+
// long-form name qualification is because of the #if conditional; we'd need a matchin #if around
55+
// a using directive, which is messy
5456
services.AddSingleton<AspNetCore.OutputCaching.IOutputCacheStore, RedisOutputCacheStoreImpl>();
5557

5658
return services;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
// Licensed to the .NET Foundation under one or more agreements.
2+
// The .NET Foundation licenses this file to you under the MIT license.
3+
4+
using System.Buffers;
5+
using System.IO.Pipelines;
6+
7+
namespace Microsoft.AspNetCore.OutputCaching;
8+
9+
/// <summary>
10+
/// Represents a store for cached responses that uses a <see cref="IBufferWriter{byte}"/> as the target.
11+
/// </summary>
12+
public interface IOutputCacheBufferStore : IOutputCacheStore
13+
{
14+
/// <summary>
15+
/// Gets the cached response for the given key, if it exists.
16+
/// If no cached response exists for the given key, <c>null</c> is returned.
17+
/// </summary>
18+
/// <param name="key">The cache key to look up.</param>
19+
/// <param name="destination">The location to which the value should be written.</param>
20+
/// <param name="cancellationToken">Indicates that the operation should be cancelled.</param>
21+
/// <returns><c>True</c> if the response cache entry if it exists; otherwise <c>False</c>.</returns>
22+
ValueTask<bool> TryGetAsync(string key, PipeWriter destination, CancellationToken cancellationToken);
23+
24+
/// <summary>
25+
/// Stores the given response in the response cache.
26+
/// </summary>
27+
/// <param name="key">The cache key to store the response under.</param>
28+
/// <param name="value">The response cache entry to store; this value is only defined for the duration of the method, and should not be stored without making a copy.</param>
29+
/// <param name="tags">The tags associated with the cache entry to store.</param>
30+
/// <param name="validFor">The amount of time the entry will be kept in the cache before expiring, relative to now.</param>
31+
/// <param name="cancellationToken">Indicates that the operation should be cancelled.</param>
32+
ValueTask SetAsync(string key, ReadOnlySequence<byte> value, ReadOnlyMemory<string> tags, TimeSpan validFor, CancellationToken cancellationToken);
33+
}
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
// Licensed to the .NET Foundation under one or more agreements.
22
// The .NET Foundation licenses this file to you under the MIT license.
33

4-
using System.Buffers;
5-
using System.IO.Pipelines;
6-
74
namespace Microsoft.AspNetCore.OutputCaching;
85

96
/// <summary>
@@ -37,29 +34,3 @@ public interface IOutputCacheStore
3734
/// <param name="cancellationToken">Indicates that the operation should be cancelled.</param>
3835
ValueTask SetAsync(string key, byte[] value, string[]? tags, TimeSpan validFor, CancellationToken cancellationToken);
3936
}
40-
41-
/// <summary>
42-
/// Represents a store for cached responses that uses a <see cref="IBufferWriter{byte}"/> as the target.
43-
/// </summary>
44-
public interface IOutputCacheBufferStore : IOutputCacheStore
45-
{
46-
/// <summary>
47-
/// Gets the cached response for the given key, if it exists.
48-
/// If no cached response exists for the given key, <c>null</c> is returned.
49-
/// </summary>
50-
/// <param name="key">The cache key to look up.</param>
51-
/// <param name="destination">The location to which the value should be written.</param>
52-
/// <param name="cancellationToken">Indicates that the operation should be cancelled.</param>
53-
/// <returns><c>True</c> if the response cache entry if it exists; otherwise <c>False</c>.</returns>
54-
ValueTask<bool> TryGetAsync(string key, PipeWriter destination, CancellationToken cancellationToken);
55-
56-
/// <summary>
57-
/// Stores the given response in the response cache.
58-
/// </summary>
59-
/// <param name="key">The cache key to store the response under.</param>
60-
/// <param name="value">The response cache entry to store; this value is only defined for the duration of the method, and should not be stored without making a copy.</param>
61-
/// <param name="tags">The tags associated with the cache entry to store.</param>
62-
/// <param name="validFor">The amount of time the entry will be kept in the cache before expiring, relative to now.</param>
63-
/// <param name="cancellationToken">Indicates that the operation should be cancelled.</param>
64-
ValueTask SetAsync(string key, ReadOnlySequence<byte> value, ReadOnlyMemory<string> tags, TimeSpan validFor, CancellationToken cancellationToken);
65-
}

0 commit comments

Comments
 (0)