Просмотр исходного кода

!382 SysCacheService 中 Exists 方法的 bug
Merge pull request !382 from taoran/next

zuohuaijun 3 лет назад
Родитель
Сommit
5c7f1676b2

+ 1 - 1
Admin.NET/Admin.NET.Core/Service/Cache/ISysCacheService.cs

@@ -8,7 +8,7 @@ public interface ISysCacheService
 
     Task DelCacheKey(string cacheKey);
 
-    bool Exists(string cacheKey);
+    Task<bool> ExistsAsync(string cacheKey);
 
     Task<List<string>> GetAllCacheKeys();
 

+ 3 - 2
Admin.NET/Admin.NET.Core/Service/Cache/SysCacheService.cs

@@ -117,9 +117,10 @@ public class SysCacheService : ISysCacheService, IDynamicApiController, ISinglet
     /// <param name="cacheKey">键</param>
     /// <returns></returns>
     [NonAction]
-    public bool Exists(string cacheKey)
+    public async Task<bool> ExistsAsync(string cacheKey)
     {
-        return _cache.Equals(cacheKey);
+        var res = await _cache.GetAsync(cacheKey);
+        return res != null;
     }
 
     /// <summary>