use of com.albedo.java.modules.monitor.domain.RedisInfo in project albedo by somowhere.
the class RedisServiceImpl method getRedisInfo.
/**
* Redis详细信息
*/
@Override
public IPage<RedisInfo> getRedisInfo() {
Properties info = redisConnectionFactory.getConnection().info();
List<RedisInfo> infoList = new ArrayList<>();
RedisInfo redisInfo;
for (Map.Entry<Object, Object> entry : info.entrySet()) {
redisInfo = new RedisInfo();
redisInfo.setKey(StringUtil.toString(entry.getKey()));
redisInfo.setValue(StringUtil.toString(entry.getValue()));
infoList.add(redisInfo);
}
return new PageModel<>(infoList, infoList.size());
}
use of com.albedo.java.modules.monitor.domain.RedisInfo in project albedo by somowhere.
the class RedisServiceImpl method getMapForReport.
/**
* 查询redis信息for报表
*
* @param reportSearchType
* @return
*/
@Override
public Map<String, JSONArray> getMapForReport(ReportSearchType reportSearchType) {
Map<String, JSONArray> mapJson = Maps.newHashMap();
JSONArray json = new JSONArray();
if (ReportSearchType.INFO.equals(reportSearchType)) {
List<RedisInfo> redisInfo = getRedisInfo().getRecords();
for (RedisInfo info : redisInfo) {
Map<String, Object> map = Maps.newHashMap();
BeanMap beanMap = BeanMap.create(info);
for (Object key : beanMap.keySet()) {
map.put(key + "", beanMap.get(key));
}
json.add(map);
}
mapJson.put("data", json);
return mapJson;
}
for (int i = 0, size = 5; i < size; i++) {
JSONObject jo = new JSONObject();
if (ReportSearchType.KEY.equals(reportSearchType)) {
jo.putOpt("value", getKeySize());
} else {
Integer usedMemory = Integer.valueOf(getUsedMemory());
jo.putOpt("value", usedMemory / 1000);
}
String createTime = DateUtil.formatTime(DateUtil.date(System.currentTimeMillis() - (4 - i) * 1000));
jo.putOpt("name", createTime);
json.add(jo);
}
mapJson.put("data", json);
return mapJson;
}
Aggregations