diff --git a/Helpers/SimApiCache.cs b/Helpers/SimApiCache.cs index 8ca460b..2e507a3 100644 --- a/Helpers/SimApiCache.cs +++ b/Helpers/SimApiCache.cs @@ -34,6 +34,16 @@ public class SimApiCache(IDistributedCache cache) cache.Remove(Prefix + key); } + /// + /// 缓存Key是否存在 + /// + /// + /// + public bool HasKey(string key) + { + return Get(key) != null; + } + /// /// 获取string类型缓存 /// diff --git a/Helpers/SimApiError.cs b/Helpers/SimApiError.cs index 57b487f..77bd715 100644 --- a/Helpers/SimApiError.cs +++ b/Helpers/SimApiError.cs @@ -11,6 +11,7 @@ public static class SimApiError /// 错误代码 /// 错误描述(若是常规错误,代码可自动带取描述) /// + [DoesNotReturn] public static void Error(int code = 500, string message = "") { throw new SimApiException(code, message);