RedisMonitorJob implements Job { int keys(Map<String, String> info) { String keySpace = info.get("db0"); if (keySpace == null) return 0; int index = keySpace.indexOf(','); return Integer.parseInt(keySpace.substring(5, index)); } RedisMonitorJob(Redis redis, String app, String host, MessagePublisher<StatMessage> publisher); @Override void execute(JobContext context); public double highMemUsageThreshold; }
@Test void keys() { assertThat(job.keys(Map.of())).isEqualTo(0); }