@Test public void decrementOnline() { Server server = addServer("sample"); for (int i = 0; i < 10; i++) { repository.incrementOnline(server.getName()); } for (int i = 0; i < 5; i++) { repository.decrementOnline(server.getName()); } assertEquals(5, repository.get("sample", new StandardServerMapper()).getOnlinePlayers()); }
@Override public void decrementOnline(String serverName) { redisTransactions.runTransaction(jedis -> { jedis.hincrBy(this.redisHashName(serverName), ServerFieldType.ONLINE.getFieldName(), -1L); }); }
RedisServerRepository implements ServerRepository { @Override public void decrementOnline(String serverName) { redisTransactions.runTransaction(jedis -> { jedis.hincrBy(this.redisHashName(serverName), ServerFieldType.ONLINE.getFieldName(), -1L); }); } }
RedisServerRepository implements ServerRepository { @Override public void decrementOnline(String serverName) { redisTransactions.runTransaction(jedis -> { jedis.hincrBy(this.redisHashName(serverName), ServerFieldType.ONLINE.getFieldName(), -1L); }); }  }
RedisServerRepository implements ServerRepository { @Override public void decrementOnline(String serverName) { redisTransactions.runTransaction(jedis -> { jedis.hincrBy(this.redisHashName(serverName), ServerFieldType.ONLINE.getFieldName(), -1L); }); }  @Override T get(String serverName, ServerMapper<T> mapper); @Override void set(String serverName, ServerFieldType type, T value); @Override List<T> getAll(List<String> names, ServerMapper<T> mapper); @Override void incrementOnline(String serverName); @Override void decrementOnline(String serverName); @Override void addServer(T server, ServerMapper<T> mapper); }
RedisServerRepository implements ServerRepository { @Override public void decrementOnline(String serverName) { redisTransactions.runTransaction(jedis -> { jedis.hincrBy(this.redisHashName(serverName), ServerFieldType.ONLINE.getFieldName(), -1L); }); }  @Override T get(String serverName, ServerMapper<T> mapper); @Override void set(String serverName, ServerFieldType type, T value); @Override List<T> getAll(List<String> names, ServerMapper<T> mapper); @Override void incrementOnline(String serverName); @Override void decrementOnline(String serverName); @Override void addServer(T server, ServerMapper<T> mapper);  }