public SelfResolvingClusterOptions(IServiceProvider services, IMemcachedClusterOptions fallback) { Allocator = services.GetService <MemoryPool <byte> >() ?? fallback.Allocator; Locator = services.GetService <INodeLocator>() ?? fallback.Locator; ReconnectPolicyFactory = services.GetService <IReconnectPolicyFactory>() ?? fallback.ReconnectPolicyFactory; FailurePolicyFactory = services.GetService <IFailurePolicyFactory>() ?? fallback.FailurePolicyFactory; SocketFactory = services.GetService <ISocketFactory>() ?? fallback.SocketFactory; }
public static IMemcachedConfigurationBuilder SetOptions(this IMemcachedConfigurationBuilder builder, IMemcachedClusterOptions options) { builder.Services.AddSingleton(options); return(builder); }