From 620bb4712a31791231c4381581f0f60088f079fe Mon Sep 17 00:00:00 2001
From: 云 <2163098428@qq.com>
Date: 星期三, 27 五月 2026 14:03:45 +0800
Subject: [PATCH] Merge branch 'refs/heads/dev_New_pro' into dev_宁夏_英泽防锈
---
src/main/java/com/ruoyi/project/monitor/controller/CacheController.java | 37 ++++++++++++++++++-------------------
1 files changed, 18 insertions(+), 19 deletions(-)
diff --git a/src/main/java/com/ruoyi/project/monitor/controller/CacheController.java b/src/main/java/com/ruoyi/project/monitor/controller/CacheController.java
index ab4841d..ac29662 100644
--- a/src/main/java/com/ruoyi/project/monitor/controller/CacheController.java
+++ b/src/main/java/com/ruoyi/project/monitor/controller/CacheController.java
@@ -2,8 +2,7 @@
import com.ruoyi.common.constant.CacheConstants;
import com.ruoyi.common.utils.StringUtils;
-import com.ruoyi.framework.web.controller.BaseController;
-import com.ruoyi.framework.web.domain.R;
+import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.project.monitor.domain.SysCache;
import lombok.AllArgsConstructor;
import org.springframework.data.redis.core.RedisCallback;
@@ -15,13 +14,13 @@
/**
* 缂撳瓨鐩戞帶
- *
+ *
* @author ruoyi
*/
@RestController
@RequestMapping("/monitor/cache")
@AllArgsConstructor
-public class CacheController extends BaseController
+public class CacheController
{
private RedisTemplate<String, String> redisTemplate;
@@ -38,7 +37,7 @@
@PreAuthorize("@ss.hasPermi('monitor:cache:list')")
@GetMapping()
- public R<?> getInfo() throws Exception
+ public AjaxResult getInfo() throws Exception
{
Properties info = (Properties) redisTemplate.execute((RedisCallback<Object>) connection -> connection.info());
Properties commandStats = (Properties) redisTemplate.execute((RedisCallback<Object>) connection -> connection.info("commandstats"));
@@ -57,56 +56,56 @@
pieList.add(data);
});
result.put("commandStats", pieList);
- return R.ok(result);
+ return AjaxResult.success(result);
}
@PreAuthorize("@ss.hasPermi('monitor:cache:list')")
@GetMapping("/getNames")
- public R<?> cache()
+ public AjaxResult cache()
{
- return R.ok(caches);
+ return AjaxResult.success(caches);
}
@PreAuthorize("@ss.hasPermi('monitor:cache:list')")
@GetMapping("/getKeys/{cacheName}")
- public R<?> getCacheKeys(@PathVariable String cacheName)
+ public AjaxResult getCacheKeys(@PathVariable String cacheName)
{
Set<String> cacheKeys = redisTemplate.keys(cacheName + "*");
- return R.ok(new TreeSet<>(cacheKeys));
+ return AjaxResult.success(new TreeSet<>(cacheKeys));
}
@PreAuthorize("@ss.hasPermi('monitor:cache:list')")
@GetMapping("/getValue/{cacheName}/{cacheKey}")
- public R<?> getCacheValue(@PathVariable String cacheName, @PathVariable String cacheKey)
+ public AjaxResult getCacheValue(@PathVariable String cacheName, @PathVariable String cacheKey)
{
String cacheValue = redisTemplate.opsForValue().get(cacheKey);
SysCache sysCache = new SysCache(cacheName, cacheKey, cacheValue);
- return R.ok(sysCache);
+ return AjaxResult.success(sysCache);
}
@PreAuthorize("@ss.hasPermi('monitor:cache:list')")
@DeleteMapping("/clearCacheName/{cacheName}")
- public R<?> clearCacheName(@PathVariable String cacheName)
+ public AjaxResult clearCacheName(@PathVariable String cacheName)
{
Collection<String> cacheKeys = redisTemplate.keys(cacheName + "*");
redisTemplate.delete(cacheKeys);
- return R.ok();
+ return AjaxResult.success();
}
@PreAuthorize("@ss.hasPermi('monitor:cache:list')")
@DeleteMapping("/clearCacheKey/{cacheKey}")
- public R<?> clearCacheKey(@PathVariable String cacheKey)
+ public AjaxResult clearCacheKey(@PathVariable String cacheKey)
{
redisTemplate.delete(cacheKey);
- return R.ok();
+ return AjaxResult.success();
}
@PreAuthorize("@ss.hasPermi('monitor:cache:list')")
@DeleteMapping("/clearCacheAll")
- public R<?> clearCacheAll()
+ public AjaxResult clearCacheAll()
{
Collection<String> cacheKeys = redisTemplate.keys("*");
redisTemplate.delete(cacheKeys);
- return R.ok();
+ return AjaxResult.success();
}
-}
\ No newline at end of file
+}
--
Gitblit v1.9.3