Skip to content

Commit

Permalink
feat: Added flush option to demo
Browse files Browse the repository at this point in the history
  • Loading branch information
Julien Ruaux committed Jul 21, 2022
1 parent d6bb21b commit b61c4e8
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,15 @@ public class Config {

private Loader loader = new Loader();
private Query query = new Query();
private boolean flush;

public boolean isFlush() {
return flush;
}

public void setFlush(boolean flush) {
this.flush = flush;
}

public Query getQuery() {
return query;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import com.zaxxer.hikari.HikariConfig;
import com.zaxxer.hikari.HikariDataSource;

import io.lettuce.core.RedisClient;
import io.lettuce.core.RedisURI;

@Component
Expand Down Expand Up @@ -50,6 +51,9 @@ public PostgresQueryExecutor(RedisURI redisURI, DataSourceProperties dataSourceP

@PostConstruct
public void executeQueries() {
if (config.isFlush()) {
RedisClient.create(redisURI).connect().sync().flushall();
}
HikariConfig hikariConfig = new HikariConfig();
hikariConfig.setJdbcUrl("jdbc:" + redisURI.toString());
hikariConfig.setDriverClassName(SidecarDriver.class.getName());
Expand Down

0 comments on commit b61c4e8

Please sign in to comment.