From a8c7a20a64e38d5baf9e8ec0d5b3a631d2ba1562 Mon Sep 17 00:00:00 2001 From: xRain Date: Sun, 26 Apr 2026 18:43:34 +0800 Subject: [PATCH] fix --- Helpers/SimApiCache.cs | 10 ++++++++++ Helpers/SimApiError.cs | 1 + 2 files changed, 11 insertions(+) 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);