From f93ccd68e914c8d9c83478bfa3f5ccf7bc48a44f Mon Sep 17 00:00:00 2001
From: 疯狂的狮子li <15040126243@163.com>
Date: 星期一, 30 一月 2023 18:08:53 +0800
Subject: [PATCH] update 优化 框架代码书写格式

---
 ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/monitor/CacheController.java |   16 ++++++----------
 1 files changed, 6 insertions(+), 10 deletions(-)

diff --git a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/monitor/CacheController.java b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/monitor/CacheController.java
index 84f17bc..85692b3 100644
--- a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/monitor/CacheController.java
+++ b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/monitor/CacheController.java
@@ -16,7 +16,6 @@
 import org.springframework.web.bind.annotation.*;
 
 import java.util.*;
-import java.util.stream.Collectors;
 
 /**
  * 缂撳瓨鐩戞帶
@@ -51,13 +50,7 @@
     @GetMapping()
     public R<Map<String, Object>> getInfo() throws Exception {
         RedisConnection connection = connectionFactory.getConnection();
-        Properties info = connection.commands().info();
         Properties commandStats = connection.commands().info("commandstats");
-        Long dbSize = connection.commands().dbSize();
-
-        Map<String, Object> result = new HashMap<>(3);
-        result.put("info", info);
-        result.put("dbSize", dbSize);
 
         List<Map<String, String>> pieList = new ArrayList<>();
         if (commandStats != null) {
@@ -69,8 +62,11 @@
                 pieList.add(data);
             });
         }
-        result.put("commandStats", pieList);
-        return R.ok(result);
+        return R.ok(Map.of(
+                "info", connection.commands().info(),
+                "dbSize", connection.commands().dbSize(),
+                "commandStats", pieList
+        ));
     }
 
     /**
@@ -94,7 +90,7 @@
         if (isCacheNames(cacheName)) {
             Set<Object> keys = CacheUtils.keys(cacheName);
             if (CollUtil.isNotEmpty(keys)) {
-                cacheKeys = keys.stream().map(Object::toString).collect(Collectors.toList());
+                cacheKeys = keys.stream().map(Object::toString).toList();
             }
         } else {
             cacheKeys = RedisUtils.keys(cacheName + "*");

--
Gitblit v1.9.3