Beispiel #1
0
        public static IClientBuilder UseRedisMembership(this IClientBuilder builder, Action <RedisOptions> configuration)
        {
            builder.Configure <ClusterMembershipOptions>(x => x.ValidateInitialConnectivity = true);
            return(builder.ConfigureServices(services =>
            {
                var options = new RedisOptions();
                configuration?.Invoke(options);

                services
                .AddSingleton(options)
                .AddSingleton(new GatewayOptions()
                {
                    GatewayListRefreshPeriod = GatewayOptions.DEFAULT_GATEWAY_LIST_REFRESH_PERIOD
                })
                .AddRedis()
                .AddSingleton <IGatewayListProvider, RedisGatewayListProvider>();
            }));
        }
Beispiel #2
0
 public static async Task <IConnectionMultiplexer> DefaultCreateMultiplexer(RedisOptions options)
 {
     return(await ConnectionMultiplexer.ConnectAsync(options.ConnectionString));
 }