diff --git a/Yi.Abp.Net8/module/rbac/Yi.Framework.Rbac.Application/Services/Monitor/MonitorCacheService.cs b/Yi.Abp.Net8/module/rbac/Yi.Framework.Rbac.Application/Services/Monitor/MonitorCacheService.cs index c6adc05f..34c0dc34 100644 --- a/Yi.Abp.Net8/module/rbac/Yi.Framework.Rbac.Application/Services/Monitor/MonitorCacheService.cs +++ b/Yi.Abp.Net8/module/rbac/Yi.Framework.Rbac.Application/Services/Monitor/MonitorCacheService.cs @@ -38,7 +38,8 @@ namespace Yi.Framework.Rbac.Application.Services.Monitor /// 获取所有key并分组 /// /// - public List GetName() + [HttpGet("monitor-cache/name")] + public List GetName() { VerifyRedisCacheEnable(); var keys = RedisClient.Keys(CacheKeyPrefix + "*"); @@ -81,21 +82,45 @@ namespace Yi.Framework.Rbac.Application.Services.Monitor } - [HttpGet("key/{cacaheName}")] + [HttpGet("monitor-cache/key/{cacaheName}")] public List GetKey(string cacaheName) { VerifyRedisCacheEnable(); - var output = RedisClient.Keys($"{cacaheName}:*").Select(x => x.RemovePreFix(cacaheName+ ":")); + var output = RedisClient.Keys($"{cacaheName}:*").Select(x => x.RemovePreFix(cacaheName + ":")); return output.ToList(); } //全部不为空 - [HttpGet("value/{cacaheName}/{cacaheKey}")] + [HttpGet("monitor-cache/value/{cacaheName}/{cacaheKey}")] public MonitorCacheGetListOutputDto GetValue(string cacaheName, string cacaheKey) { var value = RedisClient.HGet($"{cacaheName}:{cacaheKey}", "data"); return new MonitorCacheGetListOutputDto() { CacheKey = cacaheKey, CacheName = cacaheName, CacheValue = value }; } + + + + [HttpDelete("monitor-cache/key/{cacaheName}")] + public bool DeleteKey(string cacaheName) + { + VerifyRedisCacheEnable(); + RedisClient.Del($"{cacaheName}:*"); + return true; + } + + [HttpDelete("monitor-cache/value/{cacaheName}/{cacaheKey}")] + public bool DeleteValue(string cacaheName, string cacaheKey) + { + RedisClient.Del($"{cacaheName}:{cacaheKey}"); + return true; + } + + [HttpDelete("monitor-cache/clear")] + public bool DeleteClear() + { + RedisClient.FlushDb(); + return true; + } } diff --git a/Yi.RuoYi.Vue3/src/api/monitor/cache.js b/Yi.RuoYi.Vue3/src/api/monitor/cache.js index cf495d4c..c2c034b5 100644 --- a/Yi.RuoYi.Vue3/src/api/monitor/cache.js +++ b/Yi.RuoYi.Vue3/src/api/monitor/cache.js @@ -35,15 +35,15 @@ export function getCacheValue(cacheName, cacheKey) { // 清理指定名称缓存 export function clearCacheName(cacheName) { return request({ - url: '/monitor/cache/clearCacheName/' + cacheName, + url: '/monitor-cache/key/' + cacheName, method: 'delete' }) } // 清理指定键名缓存 -export function clearCacheKey(cacheKey) { +export function clearCacheKey(cacheName,cacheKey) { return request({ - url: '/monitor/cache/clearCacheKey/' + cacheKey, + url: '/monitor-cache/value/'+cacheName+'/' + cacheKey, method: 'delete' }) } @@ -51,7 +51,7 @@ export function clearCacheKey(cacheKey) { // 清理全部缓存 export function clearCacheAll() { return request({ - url: '/monitor/cache/clearCacheAll', + url: '/monitor-cache/clear', method: 'delete' }) } diff --git a/Yi.RuoYi.Vue3/src/views/monitor/cache/list.vue b/Yi.RuoYi.Vue3/src/views/monitor/cache/list.vue index 49ba7cdd..8db15e9c 100644 --- a/Yi.RuoYi.Vue3/src/views/monitor/cache/list.vue +++ b/Yi.RuoYi.Vue3/src/views/monitor/cache/list.vue @@ -207,7 +207,7 @@ function refreshCacheKeys() { /** 清理指定键名缓存 */ function handleClearCacheKey(cacheKey) { - clearCacheKey(cacheKey).then(response => { + clearCacheKey(nowCacheName.value,cacheKey).then(response => { proxy.$modal.msgSuccess("清理缓存键名[" + cacheKey + "]成功"); getCacheKeys(); });