diff --git a/Helpers/SimApiCache.cs b/Helpers/SimApiCache.cs index 2e507a3..6006794 100644 --- a/Helpers/SimApiCache.cs +++ b/Helpers/SimApiCache.cs @@ -15,6 +15,7 @@ public class SimApiCache(IDistributedCache cache) /// public void Set(string key, object value, DistributedCacheEntryOptions? options = null) { + SimApiError.ErrorWhenNull(value, 400, "缓存值不能为null"); if (options is not null) { cache.SetString(Prefix + key, SimApiUtil.Json(value), options); @@ -51,7 +52,7 @@ public class SimApiCache(IDistributedCache cache) /// public string? Get(string key) { - return cache.GetString(Prefix + key); + return Get(Prefix + key); } ///