Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

27
LINES

< > BotCompany Repo | #1014020 // mechList_raw

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (6698L/43K).

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  
svoid _onLoad_mechList_raw {
25  
  ownResource(vmBus_onMessage mechChange(
26  
    listName -> mechList_raw_cache.remove((S) listName));
27  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 18 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ekrmjmnbrukm, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lnbujpyubztb, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt, whxojlpjdney, xrpafgyirdlv

No comments. add comment

Snippet ID: #1014020
Snippet name: mechList_raw
Eternal ID of this version: #1014020/28
Text MD5: 0e3b760b5be95082304a38e6f62486e5
Transpilation MD5: d63ab164ddb94396d7d9d90def92b49a
Author: stefan
Category: javax / a.i.
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-06-29 19:03:46
Source code size: 785 bytes / 27 lines
Pitched / IR pitched: No / No
Views / Downloads: 543 / 746
Version history: 27 change(s)
Referenced in: [show references]