소스 검색

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

zuohuaijun 3 년 전
부모
커밋
5c7f1676b2
2개의 변경된 파일4개의 추가작업 그리고 3개의 파일을 삭제
  1. 1 1
      Admin.NET/Admin.NET.Core/Service/Cache/ISysCacheService.cs
  2. 3 2
      Admin.NET/Admin.NET.Core/Service/Cache/SysCacheService.cs

+ 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>