protected void Update() { if (ShowKey.IsDown()) { showingUI = !showingUI; } }
private static async Task RunShowKey(ShowKey options) { Console.WriteLine($"Showing value of the key..."); Console.WriteLine(@""); var configuration = Configuration.GetConfiguration(); var redis = ConnectionMultiplexer.Connect(configuration["RedisConnectionString"]); var server = redis.GetServer(configuration["RedisInstance"]); var database = redis.GetDatabase(); var hash = database.HashGetAll(options.Key); var value = hash.FirstOrDefault(h => h.Name == "data"); var absexp = hash.FirstOrDefault(h => h.Name == "absexp"); byte[] data = value.Value; if (hash.Length == 0) { Console.WriteLine($"Key {options.Key} does not exist."); return; } Console.WriteLine($"Key: {options.Key}"); Console.WriteLine( options.Decompress ? $"Value: {Encoding.UTF8.GetString(await Decompressor.Decompress(data))}" : $"Value: {Encoding.UTF8.GetString(data)}"); Console.WriteLine($"Expiry: {new DateTimeOffset((long) absexp.Value, TimeSpan.Zero) - DateTimeOffset.Now}"); }