fix: remove deleted domains from cache
authorFelix Dörre <felix@dogcraft.de>
Thu, 18 Aug 2016 17:52:43 +0000 (19:52 +0200)
committerFelix Dörre <felix@dogcraft.de>
Fri, 19 Aug 2016 07:30:04 +0000 (09:30 +0200)
Change-Id: Ied20e293ef3eb47a017a7efac39e681301e7579d

src/org/cacert/gigi/dbObjects/Domain.java

index 043277c..d4ffd8e 100644 (file)
@@ -66,9 +66,12 @@ public class Domain implements IdCachable, Verifyable {
         if (id == 0) {
             throw new GigiApiException("not inserted.");
         }
-        try (GigiPreparedStatement ps = new GigiPreparedStatement("UPDATE `domains` SET `deleted`=CURRENT_TIMESTAMP WHERE `id`=?")) {
-            ps.setInt(1, id);
-            ps.execute();
+        synchronized (Domain.class) {
+            myCache.remove(this);
+            try (GigiPreparedStatement ps = new GigiPreparedStatement("UPDATE `domains` SET `deleted`=CURRENT_TIMESTAMP WHERE `id`=?")) {
+                ps.setInt(1, id);
+                ps.execute();
+            }
         }
     }