Beispiel #1
0
        private RedisClient GetRedisClient()
        {
            ConfigurationOptions options = null;

            if (String.IsNullOrEmpty(ConfigurationString))
            {
                var cmdMap = CommandMap.Default;
                switch (ServerType?.ToLower())
                {
                case "sentinel":
                    cmdMap = CommandMap.Sentinel;
                    break;

                case "ssdb":
                    cmdMap = CommandMap.SSDB;
                    break;

                case "twemproxy":
                    cmdMap = CommandMap.Twemproxy;
                    break;
                }

                options = new ConfigurationOptions
                {
                    CommandMap         = cmdMap,
                    DefaultDatabase    = this.DBNumber,
                    Password           = this.Password,
                    ServiceName        = this.MasterDB,
                    ClientName         = this.ClientName,
                    Ssl                = this.Ssl,
                    AllowAdmin         = this.AllowAdmin,
                    ConnectTimeout     = this.ConnectTimeout,
                    ConnectRetry       = this.ConnectRetry,
                    AbortOnConnectFail = this.AbortOnConnectFail
                };

                foreach (string server in this.Servers.Split(','))
                {
                    options.EndPoints.Add(server);
                }
            }
            else
            {
                options = ConfigurationOptions.Parse(ConfigurationString);
            }

            var redisClient = new RedisClient(options);

            return(redisClient);
        }
Beispiel #2
0
        /// <summary>
        /// Updates versions
        /// </summary>
        private void UpdateVersions()
        {
            // Even if we are not changing the text files, print output stating that the version was updated

            // A copy of the versions file in dictionary form
            switch (ServerType.ToLower().First <char>()) // Updates the version in the dictionary
            {
            case 'v':                                    // Vanilla
                Console.WriteLine($"Updated vanilla servers from {Variables.VV} to {NewVersion}");
                Variables.UpdateVersion(ServerVersionTypes.VV, NewVersion);
                break;

            case 's':     // Snapshot
                Console.WriteLine($"Updated snapshot servers from {Variables.SV} to {NewVersion}");
                Variables.UpdateVersion(ServerVersionTypes.SV, NewVersion);
                break;
            }
        }