public ICache BuildCache(string regionName, IDictionary <string, string> properties)
        {
            ICache result;

            if (caches.TryGetValue(regionName, out result))
            {
                return(result);
            }

            if (_clientManagerStatic == null)
            {
                if (ConnectionSettings == null)
                {
                    ConnectionSettings = RedisCacheConnection.Default();
                }
                _clientManagerStatic = ConnectionMultiplexer.Connect(ConnectionSettings.Render());
            }

            if (Log.IsDebugEnabled)
            {
                var sb = new StringBuilder();
                foreach (var pair in properties)
                {
                    sb.Append(pair.Key);
                    sb.Append(" = '");
                    sb.Append(pair.Value);
                    sb.AppendLine("';");
                }
                Log.Debug(String.Format("building cache with region: {0}, properties: \n{1}", regionName, sb));
            }
            result = new RedisCache(regionName, properties, _clientManagerStatic, ConnectionSettings);
            caches.Add(regionName, result);
            return(result);
        }
        public RedisCache(string regionName, IDictionary <string, string> properties, ConnectionMultiplexer clientManager, RedisCacheConnection connectionSettings)
        {
            _serializer         = new ObjectSerializer();
            _connectionSettings = connectionSettings;
            if (clientManager == null)
            {
                throw new ArgumentNullException("clientManager");
            }
            _clientManager = clientManager;
            RegionName     = _region = regionName;

            _expiryTimeSpan = new RedisTtlConfigurationFromHash(properties).GetExpiryTimeSpan();

            if (properties != null && properties.ContainsKey("regionPrefix"))
            {
                _regionPrefix = properties["regionPrefix"];
            }
        }
 public RedisCache(string regionName, ConnectionMultiplexer clientManager, RedisCacheConnection connectionSettings)
     : this(regionName, new Dictionary <string, string>(), clientManager, connectionSettings)
 {
 }