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).

static ExpiringMap2<S, S> mechList_raw_cache = new ExpiringMap2(10000).setMap(ciMap());
static Lock mechList_raw_lock = lock();

// timeout for loading
static int mechList_raw_timeout = 60000;

static S mechList_raw(S name) ctex {
  lock mechList_raw_lock;
  
  if (empty(name)) ret "";
  
  // get from cache
  S src = mechList_raw_cache.get(name);
  if (src != null) ret src;
  
  // load & put in cache - TODO: make postPage honor this
  //temp tempSetThreadLocal(loadPage_forcedTimeout_byThread, mechList_raw_timeout);
  src = mechList_raw_fresh(name);
  if (src != null)
    mechList_raw_cache.put(name, src);
  ret src;
}

svoid _onLoad_mechList_raw {
  ownResource(vmBus_onMessage mechChange(
    listName -> mechList_raw_cache.remove((S) listName));
}

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: 544 / 746
Version history: 27 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)
#1014027 - mechList - we switched from tlftj to tlft
#1014030 - mechList_raw_fresh - now a synonym of mechList_opt_raw_fresh
#1014070 - mechListNames
#1014209 - mechList_opt_raw