فهرست منبع

修复缓存功能升级后无法使用的问题

skywolf627 3 سال پیش
والد
کامیت
8af6dea471

+ 11 - 0
Admin.NET/Admin.NET.Core/Service/Cache/SysCacheService.cs

@@ -171,6 +171,17 @@ public class SysCacheService : IDynamicApiController, ISingleton
         return _cache.Set(key, dataScopeType);
     }
 
+    /// <summary>
+    /// 获取缓存
+    /// </summary>
+    /// <param name="cacheKey"></param>
+    /// <returns></returns>
+    [HttpGet("/sysCache/detail")]
+    public dynamic CacheDetail(string cacheKey)
+    {
+        return _cache.Get<dynamic>(cacheKey);
+    }
+
     ///// <summary>
     ///// 获取菜单缓存
     ///// </summary>

+ 2 - 2
Vben2/src/api/sys/admin.ts

@@ -466,5 +466,5 @@ export const getCacheStringAsync = (cacheKey?: string) =>
 export const removeCacheAsync = (key?: string) =>
   defHttp.get<any>({ url: Api.RemoveAsync, params: { key } });
 // 根据父键删除缓存
-export const delByParentKeyAsync = (key?: string) =>
-  defHttp.get<any>({ url: Api.DelByParentKeyAsync, params: { key } });
+export const delByParentKeyAsync = (prefixKey?: string) =>
+  defHttp.get<any>({ url: Api.DelByParentKeyAsync, params: { prefixKey } });

+ 2 - 7
Vben2/src/views/sys/admin/cache/index.vue

@@ -127,13 +127,8 @@
         }
 
         var res = await getCacheStringAsync(keys[0]);
-        try {
-          jsonData.value = JSON.parse(res);
-          isJson.value = true;
-        } catch (error) {
-          isJson.value = false;
-          jsonData.value = res;
-        }
+        jsonData.value = res;
+        isJson.value = true;
       }
 
       async function onDeleteCache() {