public RedisCacheManager(IRedisConnectionWrapper connectionWrapper) { // ConnectionMultiplexer.Connect should only be called once and shared between callers _connectionWrapper = connectionWrapper; _db = _connectionWrapper.GetDatabase(); }
public RedisCacheManager(IHttpContextAccessor httpContextAccessor, IRedisConnectionWrapper connectionWrapper, MotelConfig config) { _perRequestCache = new PerRequestCache(httpContextAccessor); _connectionWrapper = connectionWrapper; _config = config; _db = connectionWrapper.GetDatabase(config.RedisDatabaseId ?? (int)RedisDatabaseNumber.Cache); }
public RedisPipelineContext(IRedisConnectionWrapper redisManager, RedisPipelineConfig config, Action <string> logAction = null) { _redisManager = redisManager; _config = config; _db = _redisManager.GetDatabase(_config.DBSpace); _logAction = logAction; }
public RedisCacheManager(IRedisConnectionWrapper connectionWrapper) { // ConnectionMultiplexer.Connect只应调用一次并在调用者之间共享 this._connectionWrapper = connectionWrapper; //默认就使用Redis 16个中的第一个数据库吧 this._db = _connectionWrapper.GetDatabase(); this._memoryCacheManager = new MemoryCacheManager(); //暂时这样 }
public RedisCacheManage(IRedisCache redisCache, IRedisConnectionWrapper redisConnectionWrapper, OarmsConfig config) { if (string.IsNullOrEmpty(config.RedisCachingConnectionString)) { throw new Exception("Redis连接字符串不能为空!"); } this._perRequestCacheManager = redisCache; this._connectionWrapper = redisConnectionWrapper; this._db = _connectionWrapper.GetDatabase(); }
public RedisCacheManager(ICacheManager perRequestCacheManager, IRedisConnectionWrapper connectionWrapper, ISettings settings) { if (string.IsNullOrEmpty(settings.Cachings.RedisConnectionString)) { throw new Exception("Redis connection string is empty"); } this._settings = settings; this._perRequestCacheManager = perRequestCacheManager; this._connectionWrapper = connectionWrapper; this._db = connectionWrapper.GetDatabase(); }
public RedisCacheManager(DbgoConfig config, IRedisConnectionWrapper connectionWrapper) { if (String.IsNullOrEmpty(config.RedisCachingConnectionString)) { throw new Exception("Redis connection string is empty"); } // ConnectionMultiplexer.Connect should only be called once and shared between callers this._connectionWrapper = connectionWrapper; this._db = _connectionWrapper.GetDatabase(); //this._perRequestCacheManager = EngineContext.Current.Resolve<ICacheManager>(); }
public RedisCacheManager(/*ICacheManager perRequestCacheManager,*/ IRedisConnectionWrapper connectionWrapper, GrandConfig config) { if (string.IsNullOrEmpty(config.RedisCachingConnectionString)) throw new Exception("Redis connection string is empty"); this._connectionWrapper = connectionWrapper; this._db = _connectionWrapper.GetDatabase(); }
public RedisCacheManager(IAppConfiguration config, IStaticCacheManager perRequestCacheManager, IRedisConnectionWrapper connectionWrapper) { _config = config; _perRequestCacheManager = perRequestCacheManager; // ConnectionMultiplexer.Connect should only be called once and shared between callers _connectionWrapper = connectionWrapper; _database = _connectionWrapper.GetDatabase(_config.CacheDatabaseIndex); }
public RedisCacheManager(DapperRepositoryConfig config, IRedisConnectionWrapper connectionWrapper) { if (String.IsNullOrEmpty(config.RedisCachingConnectionString)) { throw new Exception("Redis connection string is empty"); } // ConnectionMultiplexer.Connect should only be called once and shared between callers _connectionWrapper = connectionWrapper; _db = _connectionWrapper.GetDatabase(); }
public RedisCacheManager( IRedisConnectionWrapper connectionWrapper, string strConn) { if (string.IsNullOrEmpty(strConn)) { throw new Exception("Redis connection string is empty"); } // ConnectionMultiplexer.Connect should only be called once and shared between callers this._connectionWrapper = connectionWrapper; this._db = _connectionWrapper.GetDatabase(); }
public RedisCacheManager(IRedisConnectionWrapper connectionWrapper, ApplicationSettings config) { if (string.IsNullOrEmpty(config.Cache.GetConnectionString())) { throw new Exception("Redis connection string is empty"); } // ConnectionMultiplexer.Connect should only be called once and shared between callers _connectionWrapper = connectionWrapper; _db = _connectionWrapper.GetDatabase(config.Cache.Database ?? (int)RedisDatabaseNumber.Cache); }
public RedisCacheManager(IRedisConnectionWrapper connectionWrapper, RedisSettings config) { _config = config; if (string.IsNullOrEmpty(_config.RedisConnectionString)) { throw new Exception("Redis connection string is empty"); } _connectionWrapper = connectionWrapper; _db = _connectionWrapper.GetDatabase(_config.RedisDatabaseId ?? (int)RedisDatabaseNumber.Cache); }
public RedisCacheManager(NopConfig config, IRedisConnectionWrapper connectionWrapper) { if (String.IsNullOrEmpty(config.RedisCachingConnectionString)) { throw new Exception("Redis connection string is empty"); } // ConnectionMultiplexer.Connect 只应调用一次并在调用方之间共享 this._connectionWrapper = connectionWrapper; this._db = _connectionWrapper.GetDatabase(); this._perRequestCacheManager = EngineContext.Current.Resolve <ICacheManager>(); }
/// <summary> /// 自定义键前缀 - 构造函数 /// </summary> /// <param name="connectionWrapper">redis连接池</param> /// <param name="keyPrefix">键 前缀</param> /// <param name="expiry">失效时间</param> public RedisClient(IRedisConnectionWrapper connectionWrapper, string keyPrefix, TimeSpan expiry) { if (string.IsNullOrWhiteSpace(keyPrefix) || !Regex.IsMatch(@"^[a-zA-Z]\w+$", keyPrefix)) { throw new Exception(@"redis键前缀正确格式必须符合:^[a-zA-Z]\w+$"); } ConnectionWrapper = connectionWrapper; Db = ConnectionWrapper.GetDatabase(); KeyPrefix = keyPrefix; Expiration = expiry; RealKeySuffix = "d.r.s"; //data.real.suffix }
public RedisCacheManager(string connnectionString = "127.0.0.1") { if (String.IsNullOrEmpty(connnectionString)) { throw new Exception("Redis connection string is empty"); } // ConnectionMultiplexer.Connect should only be called once and shared between callers this._connectionWrapper = new RedisConnectionWrapper(connnectionString); this._db = _connectionWrapper.GetDatabase(); this._perRequestCacheManager = new MemoryCacheManager(); }
/// <summary> /// Ctor /// </summary> /// <param name="connectionWrapper">已初始化的redis连接管理器</param> public RedisCacheManager(IRedisConnectionWrapper connectionWrapper) { if (connectionWrapper == null) { throw new ArgumentNullException("connectionWrapper"); } this._connectionWrapper = connectionWrapper; this._db = _connectionWrapper.GetDatabase(); //Unit tests need to annot the following code this._perRequestCacheManager = EngineContext.Current.Resolve <ICacheManager>(); }
public void RemoveByPattern(string pattern) { var _db = _redisConnectionWrapper.GetDatabase(); foreach (var ep in _redisConnectionWrapper.GetEndPoints()) { var server = _redisConnectionWrapper.GetServer(ep); var keys = server.Keys(database: _db.Database, pattern: "*" + pattern + "*"); foreach (var key in keys) { Remove(key); } } }
public RedisCacheManager(IRedisConnectionWrapper connectionWrapper, SmiConfig config) { if (string.IsNullOrEmpty(config.RedisConnectionString)) { throw new Exception("Redis connection string is empty"); } // ConnectionMultiplexer.Connect should only be called once and shared between callers _connectionWrapper = connectionWrapper; _db = _connectionWrapper.GetDatabase(config.RedisDatabaseId ?? (int)RedisDatabaseNumber.Cache); _memoryCacheManager = new MemoryCacheManager(new MemoryCache(new MemoryCacheOptions())); }
public RedisCacheManager(ICacheManager perRequestCacheManager, IRedisConnectionWrapper connectionWrapper) { if (string.IsNullOrEmpty(AppSettings.Caching.RedisConnectionString)) { throw new Exception("Redis connection string is empty"); } this._perRequestCacheManager = perRequestCacheManager; // ConnectionMultiplexer.Connect should only be called once and shared between callers this._connectionWrapper = connectionWrapper; this._db = _connectionWrapper.GetDatabase(); }
public RedisCacheManager(ICacheManager perRequestCacheManager, IRedisConnectionWrapper connectionWrapper, AppConfig config) { if (string.IsNullOrEmpty(config.RedisConnectionString)) { throw new Exception("Redis connection string is empty"); } _perRequestCacheManager = perRequestCacheManager; _connectionWrapper = connectionWrapper; _db = _connectionWrapper.GetDatabase(config.RedisDatabaseId ?? (int)RedisDatabaseNumber.Cache); }
public RedisCacheManager(ICacheManager perRequestCacheManager, IRedisConnectionWrapper connectionWrapper, AnyConfig config) { if (string.IsNullOrEmpty(config.RedisConnectionString)) { throw new Exception("Redis connection string is empty"); } _perRequestCacheManager = perRequestCacheManager; // ConnectionMultiplexer.Connect should only be called once and shared between callers _connectionWrapper = connectionWrapper; _db = _connectionWrapper.GetDatabase(config.RedisDatabaseId ?? (int)RedisDatabaseNumber.Cache); }
public RedisCacheManager(IHttpContextAccessor httpContextAccessor, IRedisConnectionWrapper connectionWrapper, NopConfig config) : base(config) { if (string.IsNullOrEmpty(config.RedisConnectionString)) { throw new Exception("Redis connection string is empty"); } // ConnectionMultiplexer.Connect should only be called once and shared between callers _connectionWrapper = connectionWrapper; _db = _connectionWrapper.GetDatabase(config.RedisDatabaseId ?? (int)RedisDatabaseNumber.Cache); _perRequestCache = new PerRequestCache(httpContextAccessor); }
public RedisCacheManager(IHttpContextAccessor httpContextAccessor, IRedisConnectionWrapper connectionWrapper) { _config = Singleton <AppSettings> .Instance[nameof(CacheConfig)]; if (string.IsNullOrEmpty(_config.RedisCacheConfig.ConnectionString)) { throw new Exception("Redis connection string is empty"); } // ConnectionMultiplexer.Connect should only be called once and shared between callers _connectionWrapper = connectionWrapper; _db = _connectionWrapper.GetDatabase(_config?.RedisCacheConfig.RedisDatabaseId ?? (int)RedisDatabaseNumber.Cache); _perRequestCache = new PerRequestCache(httpContextAccessor); }
public RedisCacheManager( ICacheManager perRequestCacheManager, IRedisConnectionWrapper connectionWrapper, CacheOptions config) { if (string.IsNullOrEmpty(config.RedisCachingConnection)) { throw new Exception("Redis connection string is empty"); } _perRequestCacheManager = perRequestCacheManager; // ConnectionMultiplexer.Connect should only be called once and shared between callers _connectionWrapper = connectionWrapper; _db = _connectionWrapper.GetDatabase(); _config = config; }
public RedisCacheManager( ICacheManager perRequestCacheManager, IRedisConnectionWrapper connectionWrapper, IOptionsMonitor <ShopConfig> config) { if (string.IsNullOrWhiteSpace(config?.CurrentValue?.RedisCachingConnection)) { throw new Exception("Redis connection string is empty"); } _perRequestCacheManager = perRequestCacheManager; // ConnectionMultiplexer.Connect should only be called once and shared between callers _connectionWrapper = connectionWrapper; _db = _connectionWrapper.GetDatabase(); _config = config.CurrentValue; }
public RedisCacheManager(IRedisConnectionWrapper connectionWrapper) { ConnectionWrapper = connectionWrapper; Db = ConnectionWrapper.GetDatabase(); }
public RedisCacheManager(IRedisConnectionWrapper connection) { _connection = connection; _database = _connection.GetDatabase(); _instanceName = connection.GetInstanceName(); }
public RedisPluginsInfo(INopFileProvider fileProvider, IRedisConnectionWrapper connectionWrapper, NopConfig config) : base(fileProvider) { _db = connectionWrapper.GetDatabase(config.RedisDatabaseId ?? (int)RedisDatabaseNumber.Plugin); }
public RedisCacheManager(IRedisConnectionWrapper connectionWrapper) { this._connectionWrapper = connectionWrapper; this._db = _connectionWrapper.GetDatabase(); }