code: public static JSONArray monitorForKeyspaceHitRatio() {
          Map<String, Cache> CACHE = Redis.unmodifiableCache();
  
          JSONArray monitors = new JSONArray();
  
          if (CACHE == null || CACHE.isEmpty())
              return monitors;
  
          JSONObject monitor = new JSONObject();
          monitor.put("application", EnvUtil.getApplication());
          monitor.put("nodeId", LocalNodeManager.LOCAL_NODE_ID);
  
          for (Map.Entry<String, Cache> entry : CACHE.entrySet()) {
              Cache cache = entry.getValue();
              if (cache == null)
                  continue;
  
              try (Jedis jedis = cache.getResource()) {
                  monitor.put("instance", cache.getName());
  
                  String info = ServerOperate.info(jedis, "stats");
  
                  int keyspace_hits = Integer.parseInt(ServerOperate.getAttributeInInfo(info, "keyspace_hits")); // 查找数据库键成功的次数
                  int keyspace_misses = Integer.parseInt(ServerOperate.getAttributeInInfo(info, "keyspace_misses")); // 查找数据库键失败的次数
  
                  float keyspace_hit_ratio = 0F;
                  try {
                      keyspace_hit_ratio = (keyspace_hits * 100.00F) / (keyspace_hits + keyspace_misses);
                  } catch (Exception e) {
                      e.printStackTrace();
                      LOG.error(e);
                  }
  
                  final float _keyspace_hit_ratio = keyspace_hit_ratio;
  
                  monitors.add(new JSONObject() {{
                      putAll(monitor);
  
                      put("value", _keyspace_hit_ratio);
                      put("name", "KeyspaceHitRatio");
  //                    put("attribute", "KeyspaceHitRatio");
                  }});
              } catch (Exception e) {
                  LOG.error(String.format("Jedis Pool: %s (Grafana) monitor 出现异常", entry.getKey()), e);
              }
          }
  
          return monitors;
      }
docs: 命中率
  
  @return