public RedisCache(string regionName, IDictionary <string, string> properties, RedisCacheElement element, IRedisClientsManager clientManager) { this.serializer = new ObjectSerializer(); this.clientManager = clientManager.ThrowIfNull("clientManager"); this.RegionName = regionName.ThrowIfNull("regionName"); this.expirySeconds = element != null ? (int)element.Expiration.TotalSeconds : PropertiesHelper.GetInt32(Cfg.Environment.CacheDefaultExpiration, properties, DefaultExpiry); log.DebugFormat("using expiration : {0} seconds", this.expirySeconds); var regionPrefix = PropertiesHelper.GetString(Cfg.Environment.CacheRegionPrefix, properties, null); log.DebugFormat("using region prefix : {0}", regionPrefix); var namespacePrefix = CacheNamePrefix + this.RegionName; if (!String.IsNullOrWhiteSpace(regionPrefix)) { namespacePrefix = regionPrefix + ":" + namespacePrefix; } this.CacheNamespace = new RedisNamespace(namespacePrefix); this.SyncGeneration(); }
public RedisCache(string regionName, IDictionary<string, string> properties, RedisCacheElement element, IRedisClientsManager clientManager) { this.serializer = new ObjectSerializer(); this.clientManager = clientManager.ThrowIfNull("clientManager"); RegionName = regionName.ThrowIfNull("regionName"); expirySeconds = element != null ? (int)element.Expiration.TotalSeconds : PropertiesHelper.GetInt32(NHibernate.Cfg.Environment.CacheDefaultExpiration, properties, DefaultExpiry); log.DebugFormat("using expiration : {0} seconds", expirySeconds); var regionPrefix = PropertiesHelper.GetString(NHibernate.Cfg.Environment.CacheRegionPrefix, properties, null); log.DebugFormat("using region prefix : {0}", regionPrefix); CacheNamePrefix = element != null ? element.CachePrefix : string.Empty; var namespacePrefix = CacheNamePrefix + RegionName; if (!String.IsNullOrWhiteSpace(regionPrefix)) { namespacePrefix = regionPrefix + ":" + namespacePrefix; } CacheNamespace = new RedisNamespace(namespacePrefix); SyncGeneration(); }
public static void SetClientManager(IRedisClientsManager clientManager) { if (clientManagerStatic != null) { throw new InvalidOperationException("Redis Client Manager只能配置一次."); } clientManagerStatic = clientManager.ThrowIfNull(); }
public static void SetClientManager(IRedisClientsManager clientManager) { if (clientManagerStatic != null) { throw new InvalidOperationException("The client manager can only be configured once."); } clientManagerStatic = clientManager.ThrowIfNull(); }
public static void SetClientManager(IRedisClientsManager clientManager) { if (clientManagerStatic != null) { throw new InvalidOperationException("The client manager can only be configured once."); } clientManagerStatic = clientManager.ThrowIfNull(); }
public ExecOnceOnly(IRedisClientsManager redisManager, string hashKey, string correlationId) { redisManager.ThrowIfNull("redisManager"); hashKey.ThrowIfNull("hashKey"); this.hashKey = hashKey; this.correlationId = correlationId; if (correlationId != null) { redis = redisManager.GetClient(); var exists = !redis.SetEntryInHashIfNotExists(hashKey, correlationId, Flag); if (exists) throw HttpError.Conflict("Request {0} has already been processed".Fmt(correlationId)); } }
public ExecOnceOnly(IRedisClientsManager redisManager, string hashKey, string correlationId) { redisManager.ThrowIfNull("redisManager"); hashKey.ThrowIfNull("hashKey"); this.hashKey = hashKey; this.correlationId = correlationId; if (correlationId != null) { redis = redisManager.GetClient(); var exists = !redis.SetEntryInHashIfNotExists(hashKey, correlationId, Flag); if (exists) { throw HttpError.Conflict(ErrorMessages.RequestAlreadyProcessedFmt.Fmt(correlationId)); } } }
public RateLimitFeature(IRedisClientsManager redisClientsManager) { redisClientsManager.ThrowIfNull(nameof(redisClientsManager)); this.redisClientsManager = redisClientsManager; }
public RateLimitFeature(IRedisClientsManager redisClientsManager) { redisClientsManager.ThrowIfNull(nameof(redisClientsManager)); this.redisClientsManager = redisClientsManager; }