public static void IncreaseErrorCount(IVerifier verifier, string errorCountKey, Exception ex = null) { var errorCountsStr = RedisHelper.StringGet(RedisDBIndex, errorCountKey); int.TryParse(errorCountsStr, out int errorCount); ++errorCount; int spInt = verifier.GetLockTime(); RedisHelper.StringSet(RedisDBIndex, errorCountKey, errorCount.ToString(), TimeSpan.FromMinutes(spInt)); if (errorCount >= Constant.VIRIFY_FAILD_TIMES_LIMIT) { var minCount = GetErrorLockTime(errorCountKey); verifier.FailedMoreTimes(minCount); } else { if (ex != null) { throw ex; } verifier.VerifyFaild(Constant.VIRIFY_FAILD_TIMES_LIMIT - errorCount); } }