/// <summary> /// Copy constructor. /// </summary> /// <param name="regionName"></param> /// <param name="other"></param> public RedisCacheConfiguration(string regionName, RedisCacheConfiguration other) { RegionName = regionName; Expiration = other.Expiration; SlidingExpiration = other.SlidingExpiration; LockTimeout = other.LockTimeout; AcquireLockTimeout = other.AcquireLockTimeout; }
public RedisCache(RedisCacheConfiguration configuration, ConnectionMultiplexer connectionMultiplexer, RedisCacheProviderOptions options) { configuration.ThrowIfNull("configuration") .Validate(); RegionName = configuration.RegionName; expiration = configuration.Expiration; slidingExpiration = configuration.SlidingExpiration; lockTimeout = configuration.LockTimeout; acquireLockTimeout = configuration.AcquireLockTimeout; this.connectionMultiplexer = connectionMultiplexer.ThrowIfNull("connectionMultiplexer"); this.options = options.ThrowIfNull("options") .ShallowCloneAndValidate(); log.DebugFormat("creating cache: regionName='{0}', expiration='{1}', lockTimeout='{2}', acquireLockTimeout='{3}'", RegionName, expiration, lockTimeout, acquireLockTimeout ); CacheNamespace = new RedisNamespace(options.KeyPrefix + RegionName); }
/// <summary> /// 到redis 不可用是,处理redis 请求 /// </summary> /// <param name="configuration"></param> /// <param name="properties"></param> /// <param name="connectionMultiplexer"></param> /// <param name="options"></param> /// <returns></returns> protected override RedisCache BuildCache(RedisCacheConfiguration configuration, IDictionary <string, string> properties, ConnectionMultiplexer connectionMultiplexer, RedisCacheProviderOptions options) { //options.OnException = (e) => //{ // if (HttpContext.Current != null) // { // HttpContext.Current.Items[RequestRecoveryRedisCache.SkipNHibernateCacheKey] = true; // } // else // { // CallContext.SetData(RequestRecoveryRedisCache.SkipNHibernateCacheKey, true); // } //}; //var evtArg = new ExceptionEventArgs(configuration.RegionName, RedisCacheMethod.Clear, e); //options.OnException(this, evtArg); options.OnException(null, new ExceptionEventArgs(configuration.RegionName, RedisCacheMethod.Unknown, new Exception())); return(new RequestRecoveryRedisCache(configuration, properties, connectionMultiplexer, options)); }
protected virtual RedisCache BuildCache(RedisCacheConfiguration configuration, IDictionary <string, string> properties, ConnectionMultiplexer connectionMultiplexer, RedisCacheProviderOptions options) { return(new RedisCache(configuration, connectionMultiplexer, options)); }
public RedisCache(RedisCacheConfiguration configuration, ConnectionMultiplexer connectionMultiplexer, RedisCacheProviderOptions options) { configuration.ThrowIfNull("configuration") .Validate(); RegionName = configuration.RegionName; expiration = configuration.Expiration; slidingExpiration = configuration.SlidingExpiration; lockTimeout = configuration.LockTimeout; acquireLockTimeout = configuration.AcquireLockTimeout; this.connectionMultiplexer = connectionMultiplexer.ThrowIfNull("connectionMultiplexer"); this.options = options.ThrowIfNull("options") .ShallowCloneAndValidate(); log.DebugFormat("creating cache: regionName='{0}', expiration='{1}', lockTimeout='{2}', acquireLockTimeout='{3}'", RegionName, expiration, lockTimeout, acquireLockTimeout ); CacheNamespace = new RedisNamespace(cacheNamespacePrefix + RegionName); }
protected virtual RedisCache BuildCache(RedisCacheConfiguration configuration, IDictionary<string, string> properties, ConnectionMultiplexer connectionMultiplexer, RedisCacheProviderOptions options) { return new RedisCache(configuration, connectionMultiplexer, options); }