Skip to content

Commit

Permalink
Re-enable global cache, un-cache on PUT route to see changes
Browse files Browse the repository at this point in the history
  • Loading branch information
fsteeg committed Dec 10, 2024
1 parent 34b21ef commit 76af230
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 3 additions & 1 deletion app/controllers/nwbib/Application.java
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,8 @@ public static Promise<Result> search(final String q, final String person,
response().setHeader("Pragma", "no-cache");
response().setHeader("Expires", "0");
}
String cacheId = String.format("%s-%s", uuid, request().uri());
String cacheId = request().queryString().isEmpty() ? request().uri()
: String.format("%s-%s", uuid, request().uri());
@SuppressWarnings("unchecked")
Promise<Result> cachedResult = (Promise<Result>) Cache.get(cacheId);
if (cachedResult != null)
Expand Down Expand Up @@ -957,6 +958,7 @@ public static Promise<Result> put(String id, String secret) throws FileNotFoundE
String result = Files.readAllLines(Paths.get(output.getAbsolutePath())).stream().collect(Collectors.joining("\n"));
boolean authorized = !secret.trim().isEmpty() && secret.equals(CONFIG.getString("secret"));
if (authorized) {
Cache.remove(String.format("/%s", id));
String url = "http://weywot3:9200/resources-rpb-test/resource/"
+ URLEncoder.encode("https://lobid.org/resources/" + id, "UTF-8");
WSRequest request = WS.url(url).setHeader("Content-Type", "application/json");
Expand Down
2 changes: 0 additions & 2 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@ lazy val root = (project in file(".")).enablePlugins(PlayJava)

javacOptions ++= Seq("-source", "1.8", "-target", "1.8")

javaOptions += "-Dnet.sf.ehcache.disabled=true"

import com.typesafe.sbteclipse.core.EclipsePlugin.EclipseKeys

EclipseKeys.projectFlavor := EclipseProjectFlavor.Java // Java project. Don't expect Scala IDE
Expand Down

0 comments on commit 76af230

Please sign in to comment.