public static IServiceCollection AddDistributedRedisCache(this IServiceCollection services, IConfiguration config, ILoggerFactory logFactory = null)
        {
            if (services == null)
            {
                throw new ArgumentNullException(nameof(services));
            }

            if (config == null)
            {
                throw new ArgumentNullException(nameof(config));
            }

            RedisCacheConfiguration      redisConfig = new RedisCacheConfiguration(config);
            RedisServiceInfo             info        = config.GetSingletonServiceInfo <RedisServiceInfo>();
            RedisServiceConnectorFactory factory     = new RedisServiceConnectorFactory(info, redisConfig);;

            services.AddSingleton(typeof(IDistributedCache), factory.Create);
            return(services);
        }
Example #2
0
 public RedisServiceConnectorFactory(RedisServiceInfo sinfo, RedisCacheConfiguration config)
 {
     _info   = sinfo;
     _config = config;
 }