疯狂的狮子Li
2022-05-20 73e1d3b046402e3ba6ec20bcd695cbdb7cfef9f1
ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/CacheController.java
@@ -1,12 +1,11 @@
package com.ruoyi.web.controller.monitor;
import cn.dev33.satoken.annotation.SaCheckPermission;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.utils.StringUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.connection.RedisServerCommands;
import org.springframework.data.redis.core.RedisCallback;
import org.springframework.data.redis.core.RedisTemplate;
@@ -22,7 +21,7 @@
 * @author Lion Li
 */
@Api(value = "缓存监控", tags = {"缓存监控管理"})
@RequiredArgsConstructor(onConstructor_ = @Autowired)
@RequiredArgsConstructor
@RestController
@RequestMapping("/monitor/cache")
public class CacheController {
@@ -32,7 +31,7 @@
    @ApiOperation("获取缓存监控详细信息")
    @SaCheckPermission("monitor:cache:list")
    @GetMapping()
    public AjaxResult<Map<String, Object>> getInfo() throws Exception {
    public R<Map<String, Object>> getInfo() throws Exception {
        Properties info = (Properties) redisTemplate.execute((RedisCallback<Object>) RedisServerCommands::info);
        Properties commandStats = (Properties) redisTemplate.execute((RedisCallback<Object>) connection -> connection.info("commandstats"));
        Object dbSize = redisTemplate.execute((RedisCallback<Object>) RedisServerCommands::dbSize);
@@ -52,6 +51,6 @@
            });
        }
        result.put("commandStats", pieList);
        return AjaxResult.success(result);
        return R.ok(result);
    }
}