/// <summary> /// Update Seed Data for Local C# testing ** NOT FOR PRODUCTION ** /// </summary> /// <param name="host">Hostname of the server, set by Appconfig</param> /// <param name="port">Redis port, set by AppConfig</param> /// <param name="password">server password, set by AppConfig</param> public static void IncrementSortedSet(string host, int port, string password) { RedisUtils redisUtils = new RedisUtils(host, port, password); using (IRedisClient client = redisUtils.GetClient()) { using (var pipeline = redisUtils.GetClient().CreatePipeline()) { // proces variables var timer1 = System.Diagnostics.Stopwatch.StartNew(); int d = 1; string t2; string value; string seedFile = SeedFile; // create the see list from source list file // string source_list = ConfigurationManager.AppSettings["SourceList"]; List <string> callsigns = File.ReadLines(seedFile).ToList(); // Count the number of items in the sorted set int c = callsigns.Count; // start update loop var timer2 = System.Diagnostics.Stopwatch.StartNew(); // This is the Redis update time portion Console.Write("* R => IncrementItemInSortedSet(*)\n"); Console.WriteLine($"* Seed File Count ..: [ {c.ToString("N0")} ]"); foreach (var item in callsigns) { value = timer1.ElapsedTicks.ToString(); t2 = value.Substring(value.Length - 3); // 3 gets the last three digits ot ET in miliseconds Console.Write($"\r* Updating Keys ....: [ {d.ToString("N0")} ] "); pipeline.QueueCommand(r => r.IncrementItemInSortedSet("leaderboard", item, Convert.ToDouble(t2))); d++; } pipeline.Flush(); // push the increments to Redis timer1.Stop(); // stop the update timer var elapsedMs = timer1.ElapsedMilliseconds; Console.WriteLine($"\n* Pushed Keys ......: [ {c.ToString("N0")} ]"); Console.WriteLine($"* Update Time ......: [ {Math.Round(timer2.Elapsed.TotalSeconds, 5)} ]"); } // END - Using Pipeline } // END - IRedisClient } // END - IncrementSortedSet