Libraryless. Click here for Pure Java version (5763L/40K).
1 | static ExpiringMap2<S, S> mechList_raw_cache = new ExpiringMap2(10000).setMap(ciMap()); |
2 | static Lock mechList_raw_lock = lock(); |
3 | |
4 | // timeout for loading |
5 | static int mechList_raw_timeout = 60000; |
6 | |
7 | static S mechList_raw(S name) ctex { |
8 | lock mechList_raw_lock; |
9 | |
10 | if (empty(name)) ret ""; |
11 | |
12 | // get from cache |
13 | S src = mechList_raw_cache.get(name); |
14 | if (src != null) ret src; |
15 | |
16 | // load & put in cache - TODO: make postPage honor this |
17 | //temp tempSetThreadLocal(loadPage_forcedTimeout_byThread, mechList_raw_timeout); |
18 | src = mechList_raw_fresh(name); |
19 | if (src != null) |
20 | mechList_raw_cache.put(name, src); |
21 | ret src; |
22 | } |
23 | |
24 | static VF2<S, O> mechList_raw_listener = voidfunc(S msg, O arg) { |
25 | if (eq(msg, 'mechChange) && arg instanceof S) { |
26 | //print("Got change notification: " + arg); |
27 | mechList_raw_cache.remove((S) arg); |
28 | } |
29 | }; |
30 | |
31 | svoid _onLoad_mechList_raw { add(vm_busListeners_live(), mechList_raw_listener); } |
32 | svoid cleanMeUp_mechList_raw { remove(vm_busListeners_live(), mechList_raw_listener); } |
download show line numbers debug dex
Travelled to 17 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ekrmjmnbrukm, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lnbujpyubztb, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, whxojlpjdney, xrpafgyirdlv
No comments. add comment
Snippet ID: | #1014020 |
Snippet name: | mechList_raw |
Eternal ID of this version: | #1014020/26 |
Text MD5: | 04207ded10b7976180564abfb40a2f14 |
Transpilation MD5: | 88509b641d558a68e7e4896bd3a0de21 |
Author: | stefan |
Category: | javax / a.i. |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2019-03-21 11:21:24 |
Source code size: | 1042 bytes / 32 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 327 / 421 |
Version history: | 25 change(s) |
Referenced in: | [show references] |
Formerly at http://tinybrain.de/1014020 & http://1014020.tinybrain.de