Example #1
0
        private void Print(ICommandOutlet output, int index, string key, IDistributedLock locker, IDistributedLockNormalizer normalizer)
        {
            var content = CommandOutletContent.Create(CommandOutletColor.Gray, $"[{index}] ")
                          .Append(CommandOutletColor.DarkGreen, key);

            if (locker == null)
            {
                content.Append(CommandOutletColor.DarkRed, " NULL");
            }
            else
            {
                content.Append(CommandOutletColor.DarkYellow, $" {GetTokenString(normalizer, locker.Token)}")
                .Append(CommandOutletColor.DarkMagenta, $" {locker.Expiry}");
            }

            output.WriteLine(content);
        }
Example #2
0
 private string GetTokenString(IDistributedLockNormalizer normalizer, byte[] token)
 {
     return(normalizer == null || token == null || token.Length == 0 ? null : normalizer.GetString(token));
 }