Skip to content

Commit

Permalink
Merge pull request #10 from skodjob/redis-flush
Browse files Browse the repository at this point in the history
Redis flush
  • Loading branch information
novotnyJiri authored May 13, 2024
2 parents fa8361e + 9060075 commit e628c81
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 0 deletions.
5 changes: 5 additions & 0 deletions database-manipulation-tool/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,11 @@ You can reset all databases on DMT start with property `onstart.reset.database`.
<code>Sends a message specified in json body to the redis stream channel
specified in as header argument</code>
</summary>
<summary>
<code>GET</code>
<code><b>/Redis/reset</b></code>
<code>Flush whole Redis instance</code>
</summary>

## Running the application in dev mode

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,11 @@ public Response pollMessages(@QueryParam("max") Integer max, List<String> channe
return Response.ok(res).build();
}

@Path("reset")
@GET
public Response resetRedis() {
redisService.resetRedis();
return Response.ok().build();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,8 @@ public String insert(String channel, Map<String, String> message) {
public List<Map.Entry<String, List<StreamEntry>>> get(int amount, List<String> channels) {
return redisDataSource.pollMessages(amount, channels);
}

public void resetRedis() {
redisDataSource.flushRedis();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -78,4 +78,9 @@ public List<Map.Entry<String, List<StreamEntry>>> pollMessages(int maxAmount, Li
return jedis.xread(XReadParams.xReadParams().count(maxAmount), streams);
}

public void flushRedis() {
Jedis jedis = pool.getResource();
jedis.flushAll();
}

}

0 comments on commit e628c81

Please sign in to comment.