Exemplo n.º 1
0
        public static async Task <RedisDatabaseFactory> CreateAsync(Context context, IConnectionStringProvider provider, RedisConnectionMultiplexerConfiguration configuration)
        {
            Func <Task <IConnectionMultiplexer> > connectionMultiplexerFactory = () => RedisConnectionMultiplexer.CreateAsync(context, provider, configuration);

            Func <IConnectionMultiplexer, Task> connectionMultiplexerShutdownFunc = async m =>
            {
                ConfigurationOptions options = ConfigurationOptions.Parse(m.Configuration);
                await RedisConnectionMultiplexer.ForgetAsync(context, options);
            };

            var connectionMultiplexer = await connectionMultiplexerFactory();

            return(new RedisDatabaseFactory(connectionMultiplexer, connectionMultiplexerFactory, connectionMultiplexerShutdownFunc));
        }
Exemplo n.º 2
0
        public static async Task <RedisDatabaseFactory> CreateAsync(Context context, IConnectionStringProvider provider, RedisConnectionMultiplexerConfiguration configuration)
        {
            var databaseFactory = Create(context, provider, configuration);
            await databaseFactory.InitializeAsync();

            return(databaseFactory);
        }