From 775447528940c2bff671ceda7170d779edb6d6df Mon Sep 17 00:00:00 2001 From: Ronald Ray Date: Thu, 16 Apr 2020 12:33:47 -0700 Subject: [PATCH] Cache very short IDs. --- .../org/cassproject/ebac/repository/EcRepository.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/ebac.repository/src/main/java/org/cassproject/ebac/repository/EcRepository.java b/ebac.repository/src/main/java/org/cassproject/ebac/repository/EcRepository.java index a7c14ae85..6a6e8bd8b 100644 --- a/ebac.repository/src/main/java/org/cassproject/ebac/repository/EcRepository.java +++ b/ebac.repository/src/main/java/org/cassproject/ebac/repository/EcRepository.java @@ -592,6 +592,8 @@ private static void _saveWithoutSigning(final EcRemoteLinkedData data, final Cal if (caching) { JSObjectAdapter.$properties(cache).$delete(data.id); JSObjectAdapter.$properties(cache).$delete(data.shortId()); + if (repo != null) + JSObjectAdapter.$properties(cache).$delete(EcRemoteLinkedData.veryShortId(repo.selectedServer,data.getGuid())); } if (data.invalid()) { failure.$invoke("Data is malformed."); @@ -740,6 +742,7 @@ public void deleteRegistered(final EcRemoteLinkedData data, final Callback1 urls, final Callback0 success) { * @memberOf EcRepository * @method precachePost */ - private void precachePost(final Callback0 success, final Array cacheUrls, FormData fd, EcRepository me) { + private void precachePost(final Callback0 success, final Array cacheUrls, FormData fd, final EcRepository me) { EcRemote.postExpectingObject(me.selectedServer, "sky/repo/multiGet", fd, new Callback1() { @Override public void $invoke(Object p1) { @@ -861,6 +864,8 @@ private void precachePost(final Callback0 success, final Array cacheUrls } JSObjectAdapter.$put(cache, d.shortId(), d); JSObjectAdapter.$put(cache, d.id, d); + JSObjectAdapter.$put(cache, EcRemoteLinkedData.veryShortId(me.selectedServer,d.getGuid()), d); + } } if (success != null) { @@ -1623,6 +1628,7 @@ private Array handleSearchResults(Array if (caching) { JSObjectAdapter.$put(cache, d.shortId(), d); JSObjectAdapter.$put(cache, d.id, d); + JSObjectAdapter.$put(cache, EcRemoteLinkedData.veryShortId(selectedServer,d.getGuid()), d); } if (eachSuccess != null) { eachSuccess.$invoke(results.$get(i));