Skip to content

Commit

Permalink
Cache very short IDs.
Browse files Browse the repository at this point in the history
  • Loading branch information
Lomilar committed Apr 16, 2020
1 parent fcf3141 commit 7754475
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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.");
Expand Down Expand Up @@ -740,6 +742,7 @@ public void deleteRegistered(final EcRemoteLinkedData data, final Callback1<Stri
if (caching) {
JSObjectAdapter.$properties(cache).$delete(data.id);
JSObjectAdapter.$properties(cache).$delete(data.shortId());
JSObjectAdapter.$properties(cache).$delete(EcRemoteLinkedData.veryShortId(selectedServer,data.getGuid()));
}
final String targetUrl;
if (shouldTryUrl(data.id))
Expand Down Expand Up @@ -839,7 +842,7 @@ public void precache(final Array<String> urls, final Callback0 success) {
* @memberOf EcRepository
* @method precachePost
*/
private void precachePost(final Callback0 success, final Array<String> cacheUrls, FormData fd, EcRepository me) {
private void precachePost(final Callback0 success, final Array<String> cacheUrls, FormData fd, final EcRepository me) {
EcRemote.postExpectingObject(me.selectedServer, "sky/repo/multiGet", fd, new Callback1<Object>() {
@Override
public void $invoke(Object p1) {
Expand All @@ -861,6 +864,8 @@ private void precachePost(final Callback0 success, final Array<String> 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) {
Expand Down Expand Up @@ -1623,6 +1628,7 @@ private Array<EcRemoteLinkedData> handleSearchResults(Array<EcRemoteLinkedData>
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));
Expand Down

0 comments on commit 7754475

Please sign in to comment.