public RedisCache(IRedisCacheStrategy <Key, Value> strategy, RedisCacheConfiguration config) { _strategy = strategy ?? throw new RedisCacheException(ErrorInfo.STRATEGY_NOT_ALLOWED_NULL); if (config != null) { _strategy.SetConfig(config); } }
public RedisCacheManager(IRedisCacheStrategy cache, IConfiguration configuration, ILoggerFactory factory) { cache.EnsureNotNull(() => new RedisCacheException()); _cache = cache; _cache.SetConfig(new RedisCacheConfiguration() { ConnectString = configuration.GetSection("RedisCacheSettings:conn").Value, DB = int.Parse(configuration.GetSection("RedisCacheSettings:db").Value) }); logger = factory.CreateLogger <RedisCacheManager>(); expireMillonseconds = int.Parse(configuration.GetSection("RedisCacheSettings:expireMilliseconds").Value); expireHours = int.Parse(configuration.GetSection("RedisCacheSettings:expireHours").Value); expireMiutes = int.Parse(configuration.GetSection("RedisCacheSettings:expireMiutes").Value); expireSeconds = int.Parse(configuration.GetSection("RedisCacheSettings:expireSeconds").Value); expireDays = int.Parse(configuration.GetSection("RedisCacheSettings:expireDays").Value); }