This commit is contained in:
2026-04-26 18:43:34 +08:00
parent b6dbcd6cee
commit a8c7a20a64
2 changed files with 11 additions and 0 deletions
+10
View File
@@ -34,6 +34,16 @@ public class SimApiCache(IDistributedCache cache)
cache.Remove(Prefix + key); cache.Remove(Prefix + key);
} }
/// <summary>
/// 缓存Key是否存在
/// </summary>
/// <param name="key"></param>
/// <returns></returns>
public bool HasKey(string key)
{
return Get<string>(key) != null;
}
/// <summary> /// <summary>
/// 获取string类型缓存 /// 获取string类型缓存
/// </summary> /// </summary>
+1
View File
@@ -11,6 +11,7 @@ public static class SimApiError
/// <param name="code">错误代码</param> /// <param name="code">错误代码</param>
/// <param name="message">错误描述(若是常规错误,代码可自动带取描述)</param> /// <param name="message">错误描述(若是常规错误,代码可自动带取描述)</param>
/// <returns></returns> /// <returns></returns>
[DoesNotReturn]
public static void Error(int code = 500, string message = "") public static void Error(int code = 500, string message = "")
{ {
throw new SimApiException(code, message); throw new SimApiException(code, message);