Пример #1
0
        public static IConfigurationBuilder AddRedisConfig(this IConfigurationBuilder builder, CancellationToken cancellationToken, Action <IRedisConfigurationSource> options)
        {
            var source = new RedisConfigurationSource(cancellationToken);

            options(source);

            if (source.FileProvider == null && Path.IsPathRooted(source.Path))
            {
                source.FileProvider = new PhysicalFileProvider(Path.GetDirectoryName(source.Path));
                source.Path         = Path.GetFileName(source.Path);
            }

            builder.Add(source);
            return(builder);
        }
        public RedisConfigurationProvider(RedisConfigurationSource source, RedisConfigurationClient client) :
            base(source)
        {
            _source = source;
            _redisConfigurationClient = client;



            if (!_source.RedisConfig.Upload && source.ReloadOnChange && source.FileProvider != null)
            {
                ChangeToken.OnChange(
                    () => _redisConfigurationClient.Watch(_source.OnWatchException),
                    async() =>
                {
                    // Implement at later stage to do dynamic settings reloading
                    //LoadFile(reloading: true);
                    OnReload();
                    _source.OnReload?.Invoke();
                });
            }
        }
Пример #3
0
 public RedisConfigurationClient(RedisConfigurationSource source)
 {
     _source = source;
 }