-
Notifications
You must be signed in to change notification settings - Fork 10.3k
Add AddStackExchangeRedisCache
& AddHsts
overload
#40689
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
AddStackExchangeRedisCache
overloadAddStackExchangeRedisCache
& AddHsts
overload
src/Caching/StackExchangeRedis/src/StackExchangeRedisCacheServiceCollectionExtensions.cs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add a smoke test that this new overload works?
Probably https://github.com/dotnet/aspnetcore/blob/c85baf8db0c72ae8e68643029d514b2e737c9fae/src/Caching/StackExchangeRedis/test/CacheServiceExtensionsTests.cs is a good location.
src/Caching/StackExchangeRedis/src/StackExchangeRedisCacheServiceCollectionExtensions.cs
Show resolved
Hide resolved
Ping @ShreyasJejurkar, this is almost done just needs a minor update! |
Hi @BrennanConroy, I will finish this tomorrow most likely. Sorry for the delay, last week I was busy with my office stuff! 🙁 |
Friendly ping. I can finish it for you if it's still in-process by next week, deal? |
Adds test to conver new extension method.
|
||
services.AddOptions(); | ||
|
||
services.TryAdd(ServiceDescriptor.Singleton<IDistributedCache, RedisCache>()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did this change from Add to TryAdd? It breaks a test and is a behavioral change
/// </summary> | ||
/// <param name="services">The <see cref="IServiceCollection" /> to add services to.</param> | ||
/// <returns>The <see cref="IServiceCollection"/> so that additional calls can be chained.</returns> | ||
public static IServiceCollection AddStackExchangeRedisCache(this IServiceCollection services) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can redis be used with only default settings? I doesn't look like it. This overload shouldn't exist if settings are required.
How common is it to not use the However, I do worry like @Tratcher that this could confuse the majority who don't know how to configure options without the While I agree with @RehanSaeed's comment on the issue,
Assuming this is a pretty uncommon use case, it does work exactly the same as this new overload. I think the slight strangeness in the rare case may be a fair price to pay to eliminate overloads most developers wouldn't know how to use. Sorry @ShreyasJejurkar. We really appreciate the contributions. Don't close this yet just based on my feedback. I going to re-add the |
API review rejected the new API see #39251 (comment). Thanks for the contribution though, sorry we couldn't take it 😃 |
Contributes to #39251