package com.cn.fdapfe.web.controller.monitor;

import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.Set;
import java.util.TreeSet;

import com.alibaba.fastjson2.JSON;
import com.cn.fdapfe.common.core.redis.CaffeineCache;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.cn.fdapfe.common.constant.CacheConstants;
import com.cn.fdapfe.common.core.domain.AjaxResult;
import com.cn.fdapfe.common.utils.StringUtils;
import com.cn.fdapfe.system.domain.SysCache;

/**
 * 缓存监控
 *
 * @author ruoyi
 */
@RestController
@RequestMapping("/monitor/cache")
public class CacheController
{
//    @Autowired
//    private CaffeineCache caffeineCache;
//    @Autowired
//    private RedisTemplate<String, String> redisTemplate;

    private final static List<SysCache> caches = new ArrayList<SysCache>();
    {
        caches.add(new SysCache(CacheConstants.LOGIN_TOKEN_KEY, "用户信息"));
        caches.add(new SysCache(CacheConstants.SYS_CONFIG_KEY, "配置信息"));
        caches.add(new SysCache(CacheConstants.SYS_DICT_KEY, "数据字典"));
        caches.add(new SysCache(CacheConstants.CAPTCHA_CODE_KEY, "验证码"));
        caches.add(new SysCache(CacheConstants.REPEAT_SUBMIT_KEY, "防重提交"));
        caches.add(new SysCache(CacheConstants.RATE_LIMIT_KEY, "限流处理"));
        caches.add(new SysCache(CacheConstants.PWD_ERR_CNT_KEY, "密码错误次数"));
    }

    @PreAuthorize("@ss.hasPermi('monitor:cache:list')")
    @GetMapping()
    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"));
//        Object dbSize = redisTemplate.execute((RedisCallback<Object>) connection -> connection.dbSize());
//
//        Map<String, Object> result = new HashMap<>(3);
//        result.put("info", info);
//        result.put("dbSize", dbSize);
//
//        List<Map<String, String>> pieList = new ArrayList<>();
//        commandStats.stringPropertyNames().forEach(key -> {
//            Map<String, String> data = new HashMap<>(2);
//            String property = commandStats.getProperty(key);
//            data.put("name", StringUtils.removeStart(key, "cmdstat_"));
//            data.put("value", StringUtils.substringBetween(property, "calls=", ",usec"));
//            pieList.add(data);
//        });
//        result.put("commandStats", pieList);
        Object parse = JSON.parse("{\n" +
                "  \"msg\": \"操作成功\",\n" +
                "  \"code\": 200,\n" +
                "  \"data\": {\n" +
                "    \"commandStats\": [\n" +
                "      {\n" +
                "        \"name\": \"client|setname\",\n" +
                "        \"value\": \"81\"\n" +
                "      },\n" +
                "      {\n" +
                "        \"name\": \"subscribe\",\n" +
                "        \"value\": \"8\"\n" +
                "      },\n" +
                "      {\n" +
                "        \"name\": \"zadd\",\n" +
                "        \"value\": \"2\"\n" +
                "      },\n" +
                "      {\n" +
                "        \"name\": \"module|load\",\n" +
                "        \"value\": \"0\"\n" +
                "      },\n" +
                "      {\n" +
                "        \"name\": \"hset\",\n" +
                "        \"value\": \"2\"\n" +
                "      },\n" +
                "      {\n" +
                "        \"name\": \"hello\",\n" +
                "        \"value\": \"2314\"\n" +
                "      },\n" +
                "      {\n" +
                "        \"name\": \"module|loadex\",\n" +
                "        \"value\": \"0\"\n" +
                "      },\n" +
                "      {\n" +
                "        \"name\": \"publish\",\n" +
                "        \"value\": \"1\"\n" +
                "      },\n" +
                "      {\n" +
                "        \"name\": \"auth\",\n" +
                "        \"value\": \"2246\"\n" +
                "      },\n" +
                "      {\n" +
                "        \"name\": \"quit\",\n" +
                "        \"value\": \"421\"\n" +
                "      },\n" +
                "      {\n" +
                "        \"name\": \"select\",\n" +
                "        \"value\": \"2\"\n" +
                "      },\n" +
                "      {\n" +
                "        \"name\": \"expire\",\n" +
                "        \"value\": \"24\"\n" +
                "      },\n" +
                "      {\n" +
                "        \"name\": \"rpop\",\n" +
                "        \"value\": \"0\"\n" +
                "      },\n" +
                "      {\n" +
                "        \"name\": \"client|list\",\n" +
                "        \"value\": \"0\"\n" +
                "      },\n" +
                "      {\n" +
                "        \"name\": \"setex\",\n" +
                "        \"value\": \"166\"\n" +
                "      },\n" +
                "      {\n" +
                "        \"name\": \"del\",\n" +
                "        \"value\": \"59\"\n" +
                "      },\n" +
                "      {\n" +
                "        \"name\": \"setnx\",\n" +
                "        \"value\": \"24\"\n" +
                "      },\n" +
                "      {\n" +
                "        \"name\": \"evalsha\",\n" +
                "        \"value\": \"119\"\n" +
                "      },\n" +
                "      {\n" +
                "        \"name\": \"dbsize\",\n" +
                "        \"value\": \"1\"\n" +
                "      },\n" +
                "      {\n" +
                "        \"name\": \"keys\",\n" +
                "        \"value\": \"0\"\n" +
                "      },\n" +
                "      {\n" +
                "        \"name\": \"pttl\",\n" +
                "        \"value\": \"85\"\n" +
                "      },\n" +
                "      {\n" +
                "        \"name\": \"exists\",\n" +
                "        \"value\": \"42\"\n" +
                "      },\n" +
                "      {\n" +
                "        \"name\": \"hget\",\n" +
                "        \"value\": \"16\"\n" +
                "      },\n" +
                "      {\n" +
                "        \"name\": \"waitaof\",\n" +
                "        \"value\": \"0\"\n" +
                "      },\n" +
                "      {\n" +
                "        \"name\": \"set\",\n" +
                "        \"value\": \"1569\"\n" +
                "      },\n" +
                "      {\n" +
                "        \"name\": \"memory|usage\",\n" +
                "        \"value\": \"0\"\n" +
                "      },\n" +
                "      {\n" +
                "        \"name\": \"zrange\",\n" +
                "        \"value\": \"0\"\n" +
                "      },\n" +
                "      {\n" +
                "        \"name\": \"client|setinfo\",\n" +
                "        \"value\": \"0\"\n" +
                "      },\n" +
                "      {\n" +
                "        \"name\": \"xgroup|destroy\",\n" +
                "        \"value\": \"0\"\n" +
                "      },\n" +
                "      {\n" +
                "        \"name\": \"zrem\",\n" +
                "        \"value\": \"5\"\n" +
                "      },\n" +
                "      {\n" +
                "        \"name\": \"ping\",\n" +
                "        \"value\": \"4431\"\n" +
                "      },\n" +
                "      {\n" +
                "        \"name\": \"evalsha_ro\",\n" +
                "        \"value\": \"3\"\n" +
                "      },\n" +
                "      {\n" +
                "        \"name\": \"reset\",\n" +
                "        \"value\": \"1\"\n" +
                "      },\n" +
                "      {\n" +
                "        \"name\": \"module|unload\",\n" +
                "        \"value\": \"0\"\n" +
                "      },\n" +
                "      {\n" +
                "        \"name\": \"config|get\",\n" +
                "        \"value\": \"0\"\n" +
                "      },\n" +
                "      {\n" +
                "        \"name\": \"info\",\n" +
                "        \"value\": \"3\"\n" +
                "      },\n" +
                "      {\n" +
                "        \"name\": \"hmset\",\n" +
                "        \"value\": \"1\"\n" +
                "      },\n" +
                "      {\n" +
                "        \"name\": \"lpop\",\n" +
                "        \"value\": \"0\"\n" +
                "      },\n" +
                "      {\n" +
                "        \"name\": \"unlink\",\n" +
                "        \"value\": \"0\"\n" +
                "      },\n" +
                "      {\n" +
                "        \"name\": \"pexpire\",\n" +
                "        \"value\": \"91\"\n" +
                "      },\n" +
                "      {\n" +
                "        \"name\": \"xgroup|create\",\n" +
                "        \"value\": \"0\"\n" +
                "      },\n" +
                "      {\n" +
                "        \"name\": \"hdel\",\n" +
                "        \"value\": \"1\"\n" +
                "      },\n" +
                "      {\n" +
                "        \"name\": \"zpopmax\",\n" +
                "        \"value\": \"0\"\n" +
                "      },\n" +
                "      {\n" +
                "        \"name\": \"script|load\",\n" +
                "        \"value\": \"5\"\n" +
                "      },\n" +
                "      {\n" +
                "        \"name\": \"get\",\n" +
                "        \"value\": \"3889\"\n" +
                "      },\n" +
                "      {\n" +
                "        \"name\": \"flushall\",\n" +
                "        \"value\": \"0\"\n" +
                "      },\n" +
                "      {\n" +
                "        \"name\": \"zrangebyscore\",\n" +
                "        \"value\": \"48\"\n" +
                "      }\n" +
                "    ],\n" +
                "    \"info\": {\n" +
                "      \"used_memory_dataset_perc\": \"96.35%\",\n" +
                "      \"aof_current_rewrite_time_sec\": \"-1\",\n" +
                "      \"used_memory_peak_perc\": \"88.35%\",\n" +
                "      \"rss_overhead_ratio\": \"1.87\",\n" +
                "      \"db1\": \"keys=18,expires=0,avg_ttl=0,subexpiry=0\",\n" +
                "      \"db0\": \"keys=56,expires=1,avg_ttl=1792044,subexpiry=0\",\n" +
                "      \"active_defrag_hits\": \"0\",\n" +
                "      \"atomicvar_api\": \"c11-builtin\",\n" +
                "      \"rss_overhead_bytes\": \"5558272\",\n" +
                "      \"used_memory_vm_total\": \"89088\",\n" +
                "      \"gcc_version\": \"12.2.0\",\n" +
                "      \"keyspace_misses\": \"928\",\n" +
                "      \"mem_overhead_db_hashtable_rehashing\": \"0\",\n" +
                "      \"redis_git_dirty\": \"0\",\n" +
                "      \"errorstat_NOAUTH\": \"count=1524\",\n" +
                "      \"connected_clients\": \"1\",\n" +
                "      \"master_repl_offset\": \"0\",\n" +
                "      \"repl_backlog_active\": \"0\",\n" +
                "      \"rdb_changes_since_last_save\": \"21\",\n" +
                "      \"client_recent_max_output_buffer\": \"0\",\n" +
                "      \"rejected_connections\": \"0\",\n" +
                "      \"unexpected_error_replies\": \"0\",\n" +
                "      \"io_threads_active\": \"0\",\n" +
                "      \"async_loading\": \"0\",\n" +
                "      \"mem_cluster_links\": \"0\",\n" +
                "      \"total_blocking_keys_on_nokey\": \"0\",\n" +
                "      \"run_id\": \"ae22af1068bfe4b5a8b304fcecd585075a4fbe6f\",\n" +
                "      \"client_output_buffer_limit_disconnections\": \"0\",\n" +
                "      \"maxmemory\": \"0\",\n" +
                "      \"mem_allocator\": \"jemalloc-5.3.0\",\n" +
                "      \"rdb_last_load_keys_loaded\": \"50\",\n" +
                "      \"used_cpu_sys\": \"1190.874739\",\n" +
                "      \"expired_stale_perc\": \"0.00\",\n" +
                "      \"blocked_clients\": \"0\",\n" +
                "      \"total_eviction_exceeded_time\": \"0\",\n" +
                "      \"total_blocking_keys\": \"0\",\n" +
                "      \"total_commands_processed\": \"15659\",\n" +
                "      \"watching_clients\": \"0\",\n" +
                "      \"current_active_defrag_time\": \"0\",\n" +
                "      \"sync_partial_err\": \"0\",\n" +
                "      \"current_save_keys_total\": \"0\",\n" +
                "      \"acl_access_denied_key\": \"0\",\n" +
                "      \"eventloop_duration_cmd_sum\": \"116208\",\n" +
                "      \"total_connections_received\": \"4415\",\n" +
                "      \"evicted_keys\": \"0\",\n" +
                "      \"maxmemory_policy\": \"noeviction\",\n" +
                "      \"used_cpu_sys_main_thread\": \"1190.867543\",\n" +
                "      \"config_file\": \"\",\n" +
                "      \"used_memory_human\": \"1.81M\",\n" +
                "      \"allocator_rss_ratio\": \"1.86\",\n" +
                "      \"connected_slaves\": \"0\",\n" +
                "      \"role\": \"master\",\n" +
                "      \"process_supervised\": \"no\",\n" +
                "      \"aof_last_cow_size\": \"0\",\n" +
                "      \"used_memory_rss_human\": \"11.38M\",\n" +
                "      \"cluster_enabled\": \"0\",\n" +
                "      \"total_net_repl_output_bytes\": \"0\",\n" +
                "      \"allocator_rss_bytes\": \"2940928\",\n" +
                "      \"mem_fragmentation_ratio\": \"6.28\",\n" +
                "      \"used_memory_scripts\": \"6496\",\n" +
                "      \"errorstat_NOSCRIPT\": \"count=3\",\n" +
                "      \"repl_backlog_size\": \"1048576\",\n" +
                "      \"current_eviction_exceeded_time\": \"0\",\n" +
                "      \"pubsubshard_channels\": \"0\",\n" +
                "      \"uptime_in_days\": \"21\",\n" +
                "      \"used_memory_peak\": \"2151216\",\n" +
                "      \"number_of_cached_scripts\": \"4\",\n" +
                "      \"mem_fragmentation_bytes\": \"10028680\",\n" +
                "      \"used_memory_startup\": \"946344\",\n" +
                "      \"total_system_memory_human\": \"3.57G\",\n" +
                "      \"number_of_functions\": \"0\",\n" +
                "      \"hz\": \"10\",\n" +
                "      \"used_memory_lua_human\": \"55.00K\",\n" +
                "      \"instantaneous_input_kbps\": \"0.08\",\n" +
                "      \"used_memory_scripts_human\": \"6.34K\",\n" +
                "      \"rdb_bgsave_in_progress\": \"0\",\n" +
                "      \"monotonic_clock\": \"POSIX clock_gettime\",\n" +
                "      \"total_net_output_bytes\": \"3457554\",\n" +
                "      \"uptime_in_seconds\": \"1832815\",\n" +
                "      \"mem_clients_normal\": \"23424\",\n" +
                "      \"total_forks\": \"75\",\n" +
                "      \"eventloop_cycles\": \"18281805\",\n" +
                "      \"evicted_clients\": \"0\",\n" +
                "      \"slave_expires_tracked_keys\": \"0\",\n" +
                "      \"current_fork_perc\": \"0.00\",\n" +
                "      \"master_replid2\": \"0000000000000000000000000000000000000000\",\n" +
                "      \"total_net_input_bytes\": \"1918463\",\n" +
                "      \"total_net_repl_input_bytes\": \"0\",\n" +
                "      \"current_cow_peak\": \"0\",\n" +
                "      \"used_memory_scripts_eval\": \"6304\",\n" +
                "      \"instantaneous_output_kbps\": \"1.40\",\n" +
                "      \"expired_keys\": \"93\",\n" +
                "      \"allocator_frag_ratio\": \"1.16\",\n" +
                "      \"aof_last_write_status\": \"ok\",\n" +
                "      \"used_memory_vm_functions\": \"32768\",\n" +
                "      \"redis_version\": \"7.4.1\",\n" +
                "      \"allocator_frag_bytes\": \"362232\",\n" +
                "      \"mem_total_replication_buffers\": \"0\",\n" +
                "      \"maxmemory_human\": \"0B\",\n" +
                "      \"rdb_last_save_time\": \"1748342805\",\n" +
                "      \"lazyfree_pending_objects\": \"0\",\n" +
                "      \"aof_rewrite_scheduled\": \"0\",\n" +
                "      \"migrate_cached_sockets\": \"0\",\n" +
                "      \"keyspace_hits\": \"3152\",\n" +
                "      \"instantaneous_eventloop_duration_usec\": \"269\",\n" +
                "      \"allocator_allocated\": \"2971880\",\n" +
                "      \"used_memory\": \"1900696\",\n" +
                "      \"errorstat_WRONGPASS\": \"count=4075\",\n" +
                "      \"mem_replication_backlog\": \"0\",\n" +
                "      \"used_memory_dataset\": \"919496\",\n" +
                "      \"rdb_saves\": \"75\",\n" +
                "      \"pubsub_patterns\": \"0\",\n" +
                "      \"eventloop_duration_sum\": \"4623290064\",\n" +
                "      \"used_cpu_user_children\": \"0.048621\",\n" +
                "      \"master_replid\": \"b1f921821ac908f6e2f1e10a83d500c1b75fa970\",\n" +
                "      \"total_error_replies\": \"5791\",\n" +
                "      \"mem_aof_buffer\": \"0\",\n" +
                "      \"rdb_last_bgsave_status\": \"ok\",\n" +
                "      \"redis_mode\": \"standalone\",\n" +
                "      \"total_writes_processed\": \"16835\",\n" +
                "      \"allocator_resident\": \"6369280\",\n" +
                "      \"instantaneous_output_repl_kbps\": \"0.00\",\n" +
                "      \"allocator_active\": \"3428352\",\n" +
                "      \"total_active_defrag_time\": \"0\",\n" +
                "      \"current_cow_size_age\": \"0\",\n" +
                "      \"current_save_keys_processed\": \"0\",\n" +
                "      \"expired_time_cap_reached_count\": \"0\",\n" +
                "      \"sync_full\": \"0\",\n" +
                "      \"instantaneous_input_repl_kbps\": \"0.00\",\n" +
                "      \"rdb_current_bgsave_time_sec\": \"-1\",\n" +
                "      \"aof_rewrite_in_progress\": \"0\",\n" +
                "      \"multiplexing_api\": \"epoll\",\n" +
                "      \"module_fork_in_progress\": \"0\",\n" +
                "      \"tracking_clients\": \"0\",\n" +
                "      \"rdb_last_cow_size\": \"995328\",\n" +
                "      \"listener0\": \"name=tcp,bind=*,bind=-::*,port=6379\",\n" +
                "      \"acl_access_denied_cmd\": \"0\",\n" +
                "      \"mem_not_counted_for_evict\": \"0\",\n" +
                "      \"total_watched_keys\": \"0\",\n" +
                "      \"dump_payload_sanitizations\": \"0\",\n" +
                "      \"redis_git_sha1\": \"00000000\",\n" +
                "      \"tracking_total_keys\": \"0\",\n" +
                "      \"maxclients\": \"10000\",\n" +
                "      \"clients_in_timeout_table\": \"0\",\n" +
                "      \"latest_fork_usec\": \"528\",\n" +
                "      \"reply_buffer_expands\": \"804\",\n" +
                "      \"instantaneous_eventloop_cycles_per_sec\": \"10\",\n" +
                "      \"rdb_last_bgsave_time_sec\": \"0\",\n" +
                "      \"os\": \"Linux 5.14.0-522.el9.x86_64 x86_64\",\n" +
                "      \"allocator_muzzy\": \"0\",\n" +
                "      \"used_cpu_sys_children\": \"0.150855\",\n" +
                "      \"sync_partial_ok\": \"0\",\n" +
                "      \"module_fork_last_cow_size\": \"0\",\n" +
                "      \"arch_bits\": \"64\",\n" +
                "      \"used_memory_vm_eval\": \"56320\",\n" +
                "      \"used_memory_lua\": \"56320\",\n" +
                "      \"mem_clients_slaves\": \"0\",\n" +
                "      \"tracking_total_items\": \"0\",\n" +
                "      \"used_cpu_user_main_thread\": \"3674.579244\",\n" +
                "      \"lazyfreed_objects\": \"0\",\n" +
                "      \"process_id\": \"1\",\n" +
                "      \"errorstat_ERR\": \"count=189\",\n" +
                "      \"tracking_total_prefixes\": \"0\",\n" +
                "      \"total_system_memory\": \"3834646528\",\n" +
                "      \"master_failover_state\": \"no-failover\",\n" +
                "      \"aof_rewrites_consecutive_failures\": \"0\",\n" +
                "      \"repl_backlog_histlen\": \"0\",\n" +
                "      \"used_memory_vm_total_human\": \"87.00K\",\n" +
                "      \"executable\": \"/data/redis-server\",\n" +
                "      \"client_query_buffer_limit_disconnections\": \"0\",\n" +
                "      \"used_memory_rss\": \"11927552\",\n" +
                "      \"loading\": \"0\",\n" +
                "      \"active_defrag_running\": \"0\",\n" +
                "      \"used_memory_peak_human\": \"2.05M\",\n" +
                "      \"reply_buffer_shrinks\": \"1748\",\n" +
                "      \"aof_enabled\": \"0\",\n" +
                "      \"io_threaded_reads_processed\": \"0\",\n" +
                "      \"rdb_last_load_keys_expired\": \"0\",\n" +
                "      \"second_repl_offset\": \"-1\",\n" +
                "      \"total_reads_processed\": \"21141\",\n" +
                "      \"active_defrag_misses\": \"0\",\n" +
                "      \"configured_hz\": \"10\",\n" +
                "      \"active_defrag_key_hits\": \"0\",\n" +
                "      \"number_of_libraries\": \"0\",\n" +
                "      \"used_cpu_user\": \"3674.584755\",\n" +
                "      \"acl_access_denied_channel\": \"0\",\n" +
                "      \"pubsub_clients\": \"0\",\n" +
                "      \"expired_subkeys\": \"0\",\n" +
                "      \"io_threaded_writes_processed\": \"0\",\n" +
                "      \"aof_rewrites\": \"0\",\n" +
                "      \"evicted_scripts\": \"0\",\n" +
                "      \"redis_build_id\": \"cf1644279f83f09b\",\n" +
                "      \"cluster_connections\": \"0\",\n" +
                "      \"aof_last_bgrewrite_status\": \"ok\",\n" +
                "      \"client_recent_max_input_buffer\": \"20480\",\n" +
                "      \"active_defrag_key_misses\": \"0\",\n" +
                "      \"used_memory_functions\": \"192\",\n" +
                "      \"repl_backlog_first_byte_offset\": \"0\",\n" +
                "      \"instantaneous_ops_per_sec\": \"1\",\n" +
                "      \"expire_cycle_cpu_milliseconds\": \"43997\",\n" +
                "      \"current_cow_size\": \"0\",\n" +
                "      \"tcp_port\": \"6379\",\n" +
                "      \"pubsub_channels\": \"0\",\n" +
                "      \"server_time_usec\": \"1748342845260501\",\n" +
                "      \"lru_clock\": \"3512381\",\n" +
                "      \"acl_access_denied_auth\": \"4075\",\n" +
                "      \"aof_last_rewrite_time_sec\": \"-1\",\n" +
                "      \"used_memory_overhead\": \"981200\"\n" +
                "    },\n" +
                "    \"dbSize\": 56\n" +
                "  }\n" +
                "}");
        return AjaxResult.success(parse);
    }
//
//    @PreAuthorize("@ss.hasPermi('monitor:cache:list')")
//    @GetMapping("/getNames")
//    public AjaxResult cache()
//    {
//        return AjaxResult.success(caches);
//    }
//
//    @PreAuthorize("@ss.hasPermi('monitor:cache:list')")
//    @GetMapping("/getKeys/{cacheName}")
//    public AjaxResult getCacheKeys(@PathVariable String cacheName)
//    {
//        Set<String> cacheKeys = redisTemplate.keys(cacheName + "*");
//        return AjaxResult.success(new TreeSet<>(cacheKeys));
//    }
//
//    @PreAuthorize("@ss.hasPermi('monitor:cache:list')")
//    @GetMapping("/getValue/{cacheName}/{cacheKey}")
//    public AjaxResult getCacheValue(@PathVariable String cacheName, @PathVariable String cacheKey)
//    {
//        String cacheValue = redisTemplate.opsForValue().get(cacheKey);
//        SysCache sysCache = new SysCache(cacheName, cacheKey, cacheValue);
//        return AjaxResult.success(sysCache);
//    }
//
//    @PreAuthorize("@ss.hasPermi('monitor:cache:list')")
//    @DeleteMapping("/clearCacheName/{cacheName}")
//    public AjaxResult clearCacheName(@PathVariable String cacheName)
//    {
//        Collection<String> cacheKeys = redisTemplate.keys(cacheName + "*");
//        redisTemplate.delete(cacheKeys);
//        return AjaxResult.success();
//    }
//
//    @PreAuthorize("@ss.hasPermi('monitor:cache:list')")
//    @DeleteMapping("/clearCacheKey/{cacheKey}")
//    public AjaxResult clearCacheKey(@PathVariable String cacheKey)
//    {
//        redisTemplate.delete(cacheKey);
//        return AjaxResult.success();
//    }
//
//    @PreAuthorize("@ss.hasPermi('monitor:cache:list')")
//    @DeleteMapping("/clearCacheAll")
//    public AjaxResult clearCacheAll()
//    {
//        Collection<String> cacheKeys = redisTemplate.keys("*");
//        redisTemplate.delete(cacheKeys);
//        return AjaxResult.success();
//    }
}
