sbool loadSnippets_verbose; static L<S> loadSnippets(S... ids) { ret loadSnippets(asList(ids)); } static L<S> loadSnippets(L<S> ids) ctex { new L<S> texts; new StringBuilder buf; new Map<Long, S> cached; initSnippetCache(); for (S id : ids) { long snippetID = psI(id); S text = DiskSnippetCache_get(snippetID); S md5 = text != null ? md5(text) : "."; if (loadSnippets_verbose) print(id + " => " + md5 + " - " + quote(shorten(text, 20))); mapPut(cached, snippetID, text); buf.append(snippetID).append(" ").append(md5).append(" "); } if (loadSnippets_verbose) print("loadSnippets post data: " + buf); Map<S, O> map = jsonDecodeMap(doPost( "ids=" + urlencode(trim(str(buf))) + standardCredentials(), tb_mainServer() + "/get-multi2.php")); for (S id : ids) { long snippetID = psI(id); O result = map.get(str(snippetID)); if (loadSnippets_verbose) print(id + " => " + className(result)); if (result instanceof S) { texts.add((S) result); DiskSnippetCache_put(snippetID, (S) result); } else texts.add(cached.get(snippetID)); } ret texts; }
Began life as a copy of #1003764
download show line numbers debug dex old transpilations
Travelled to 15 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ddnzoavkxhuk, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1003875 |
Snippet name: | loadSnippets v2 - fetch multiple snippets in one go - yes it uses POST (LIVE) |
Eternal ID of this version: | #1003875/13 |
Text MD5: | ca49ea691c1e7e769de14329f39f434f |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2019-03-19 23:47:10 |
Source code size: | 1196 bytes / 41 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 675 / 1374 |
Version history: | 12 change(s) |
Referenced in: | [show references] |