Skip to content

Commit 106d3ee

Browse files
committed
fix cache
1 parent a8c7a20 commit 106d3ee

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

Helpers/SimApiCache.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ public class SimApiCache(IDistributedCache cache)
1515
/// <param name="options"></param>
1616
public void Set(string key, object value, DistributedCacheEntryOptions? options = null)
1717
{
18+
SimApiError.ErrorWhenNull(value, 400, "缓存值不能为null");
1819
if (options is not null)
1920
{
2021
cache.SetString(Prefix + key, SimApiUtil.Json(value), options);
@@ -51,7 +52,7 @@ public bool HasKey(string key)
5152
/// <returns></returns>
5253
public string? Get(string key)
5354
{
54-
return cache.GetString(Prefix + key);
55+
return Get<string>(Prefix + key);
5556
}
5657

5758
/// <summary>

0 commit comments

Comments
 (0)