Skip to content

Commit

Permalink
Merge pull request #116 from vsreekanti/master
Browse files Browse the repository at this point in the history
controllers: Fix bug in caching to use different keys
  • Loading branch information
vsreekanti authored Aug 24, 2017
2 parents 04459e5 + 199209f commit 03cef1b
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public final CompletionStage<Result> getEdge(final String sourceKey) {
() -> {
try {
return this.cache.getOrElse(
"edges",
"edges." + sourceKey,
() -> Json.toJson(this.postgresEdgeDao.retrieveFromDatabase(sourceKey)),
Integer.parseInt(System.getProperty("ground.cache.expire.secs")));
} catch (Exception e) {
Expand Down Expand Up @@ -83,7 +83,7 @@ public final CompletionStage<Result> getEdgeVersion(Long id) {
() -> {
try {
return this.cache.getOrElse(
"edge_versions",
"edge_versions." + id,
() -> Json.toJson(this.postgresEdgeVersionDao.retrieveFromDatabase(id)),
Integer.parseInt(System.getProperty("ground.cache.expire.secs")));
} catch (Exception e) {
Expand Down Expand Up @@ -123,7 +123,7 @@ public final CompletionStage<Result> getLatest(String sourceKey) {
() -> {
try {
return this.cache.getOrElse(
"edge_leaves",
"edge_leaves." + sourceKey,
() -> Json.toJson(this.postgresEdgeDao.getLeaves(sourceKey)),
Integer.parseInt(System.getProperty("ground.cache.expire.secs")));
} catch (Exception e) {
Expand All @@ -140,7 +140,7 @@ public final CompletionStage<Result> getHistory(String sourceKey) {
() -> {
try {
return this.cache.getOrElse(
"edge_history",
"edge_history." + sourceKey,
() -> Json.toJson(this.postgresEdgeDao.getHistory(sourceKey)),
Integer.parseInt(System.getProperty("ground.cache.expire.secs")));
} catch (Exception e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public final CompletionStage<Result> getGraph(String sourceKey) {
() -> {
try {
return this.cache.getOrElse(
"graphs",
"graphs." + sourceKey,
() -> Json.toJson(this.postgresGraphDao.retrieveFromDatabase(sourceKey)),
Integer.parseInt(System.getProperty("ground.cache.expire.secs")));
} catch (Exception e) {
Expand All @@ -74,7 +74,7 @@ public final CompletionStage<Result> getGraphVersion(Long id) {
return CompletableFuture.supplyAsync(
() -> {
try {
return this.cache.getOrElse("graph_versions",
return this.cache.getOrElse("graph_versions." + id,
() -> Json.toJson(this.postgresGraphVersionDao.retrieveFromDatabase(id)),
Integer.parseInt(System.getProperty("ground.cache.expire.secs")));
} catch (Exception e) {
Expand Down Expand Up @@ -132,7 +132,7 @@ public final CompletionStage<Result> getLatest(String sourceKey) {
() -> {
try {
return this.cache.getOrElse(
"graph_leaves",
"graph_leaves." + sourceKey,
() -> Json.toJson(this.postgresGraphDao.getLeaves(sourceKey)),
Integer.parseInt(System.getProperty("ground.cache.expire.secs")));
} catch (Exception e) {
Expand All @@ -149,7 +149,7 @@ public final CompletionStage<Result> getHistory(String sourceKey) {
() -> {
try {
return this.cache.getOrElse(
"graph_history",
"graph_history." + sourceKey,
() -> Json.toJson(this.postgresGraphDao.getHistory(sourceKey)),
Integer.parseInt(System.getProperty("ground.cache.expire.secs")));
} catch (Exception e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public final CompletionStage<Result> getLineageEdge(String sourceKey) {
() -> {
try {
return this.cache.getOrElse(
"lineage_edges",
"lineage_edges." + sourceKey,
() -> Json.toJson(this.postgresLineageEdgeDao.retrieveFromDatabase(sourceKey)),
Integer.parseInt(System.getProperty("ground.cache.expire.secs")));
} catch (Exception e) {
Expand All @@ -63,7 +63,7 @@ public final CompletionStage<Result> getLineageEdgeVersion(Long id) {
() -> {
try {
return this.cache.getOrElse(
"lineage_edge_versions",
"lineage_edge_versions." + id,
() -> Json.toJson(this.postgresLineageEdgeVersionDao.retrieveFromDatabase(id)),
Integer.parseInt(System.getProperty("ground.cache.expire.secs")));
} catch (Exception e) {
Expand Down Expand Up @@ -120,7 +120,7 @@ public final CompletionStage<Result> getLatest(String sourceKey) {
() -> {
try {
return this.cache.getOrElse(
"lineage_edge_leaves",
"lineage_edge_leaves." + sourceKey,
() -> Json.toJson(this.postgresLineageEdgeDao.getLeaves(sourceKey)),
Integer.parseInt(System.getProperty("ground.cache.expire.secs")));
} catch (Exception e) {
Expand All @@ -137,7 +137,7 @@ public final CompletionStage<Result> getHistory(String sourceKey) {
() -> {
try {
return this.cache.getOrElse(
"lineage_edge_history",
"lineage_edge_history." + sourceKey,
() -> Json.toJson(this.postgresLineageEdgeDao.getHistory(sourceKey)),
Integer.parseInt(System.getProperty("ground.cache.expire.secs")));
} catch (Exception e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public final CompletionStage<Result> getLineageGraph(String sourceKey) {
() -> {
try {
return this.cache.getOrElse(
"lineage_graphs",
"lineage_graphs." + sourceKey,
() -> Json.toJson(this.postgresLineageGraphDao.retrieveFromDatabase(sourceKey)),
Integer.parseInt(System.getProperty("ground.cache.expire.secs")));
} catch (Exception e) {
Expand All @@ -64,7 +64,7 @@ public final CompletionStage<Result> getLineageGraphVersion(Long id) {
() -> {
try {
return this.cache.getOrElse(
"lineage_graph_versions",
"lineage_graph_versions." + id,
() -> Json.toJson(this.postgresLineageGraphVersionDao.retrieveFromDatabase(id)),
Integer.parseInt(System.getProperty("ground.cache.expire.secs")));
} catch (Exception e) {
Expand Down Expand Up @@ -121,7 +121,7 @@ public final CompletionStage<Result> getLatest(String sourceKey) {
() -> {
try {
return this.cache.getOrElse(
"lineage_graph__leaves",
"lineage_graph_leaves." + sourceKey,
() -> Json.toJson(this.postgresLineageGraphDao.getLeaves(sourceKey)),
Integer.parseInt(System.getProperty("ground.cache.expire.secs")));
} catch (Exception e) {
Expand All @@ -138,7 +138,7 @@ public final CompletionStage<Result> getHistory(String sourceKey) {
() -> {
try {
return this.cache.getOrElse(
"lineage_graph__history",
"lineage_graph_history." + sourceKey,
() -> Json.toJson(this.postgresLineageGraphDao.getHistory(sourceKey)),
Integer.parseInt(System.getProperty("ground.cache.expire.secs")));
} catch (Exception e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public final CompletionStage<Result> getNode(String sourceKey) {
() -> {
try {
return this.cache.getOrElse(
"nodes",
"nodes." + sourceKey,
() -> Json.toJson(this.postgresNodeDao.retrieveFromDatabase(sourceKey)),
Integer.parseInt(System.getProperty("ground.cache.expire.secs")));
} catch (Exception e) {
Expand Down Expand Up @@ -81,7 +81,7 @@ public final CompletionStage<Result> getNodeVersion(Long id) {
() -> {
try {
return this.cache.getOrElse(
"node_versions",
"node_versions." + id,
() -> Json.toJson(this.postgresNodeVersionDao.retrieveFromDatabase(id)),
Integer.parseInt(System.getProperty("ground.cache.expire.secs")));
} catch (Exception e) {
Expand Down Expand Up @@ -121,7 +121,7 @@ public final CompletionStage<Result> getLatest(String sourceKey) {
() -> {
try {
return this.cache.getOrElse(
"node_leaves",
"node_leaves." + sourceKey,
() -> Json.toJson(this.postgresNodeDao.getLeaves(sourceKey)),
Integer.parseInt(System.getProperty("ground.cache.expire.secs")));
} catch (Exception e) {
Expand All @@ -138,7 +138,7 @@ public final CompletionStage<Result> getHistory(String sourceKey) {
() -> {
try {
return this.cache.getOrElse(
"node_history",
"node_history." + sourceKey,
() -> Json.toJson(this.postgresNodeDao.getHistory(sourceKey)),
Integer.parseInt(System.getProperty("ground.cache.expire.secs")));
} catch (Exception e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public final CompletionStage<Result> getStructure(String sourceKey) {
() -> {
try {
return this.cache.getOrElse(
"structures",
"structures." + sourceKey,
() -> Json.toJson(this.postgresStructureDao.retrieveFromDatabase(sourceKey)),
Integer.parseInt(System.getProperty("ground.cache.expire.secs")));
} catch (Exception e) {
Expand All @@ -73,7 +73,7 @@ public final CompletionStage<Result> getStructureVersion(Long id) {
() -> {
try {
return this.cache.getOrElse(
"structure_versions",
"structure_versions." + id,
() -> Json.toJson(this.postgresStructureVersionDao.retrieveFromDatabase(id)),
Integer.parseInt(System.getProperty("ground.cache.expire.secs")));
} catch (Exception e) {
Expand Down Expand Up @@ -132,7 +132,7 @@ public final CompletionStage<Result> getLatest(String sourceKey) {
() -> {
try {
return this.cache.getOrElse(
"structure_leaves",
"structure_leaves." + sourceKey,
() -> Json.toJson(this.postgresStructureDao.getLeaves(sourceKey)),
Integer.parseInt(System.getProperty("ground.cache.expire.secs")));
} catch (Exception e) {
Expand All @@ -149,7 +149,7 @@ public final CompletionStage<Result> getHistory(String sourceKey) {
() -> {
try {
return this.cache.getOrElse(
"structure_history",
"structure_history." + sourceKey,
() -> Json.toJson(this.postgresStructureDao.getHistory(sourceKey)),
Integer.parseInt(System.getProperty("ground.cache.expire.secs")));
} catch (Exception e) {
Expand Down

0 comments on commit 03cef1b

Please sign in to comment.