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

22
LINES

< > BotCompany Repo | #1018251 // MechListDependentCache - depends on a single mech list

JavaX fragment (include)

sclass MechListDependentCache<A> extends Cache<A> {
  // maker is now F1<S, A>
  S listName, lastListContents;
  
  *() {}
  *(S *listName, O *maker) {}
  
  A make() { ret (A) callF(maker, lastListContents); }
  
  A get() {
    if (hasLock(lock)) ret value; // Must be called from within maker
    {
      S listContents = mL_raw(listName);
      lock lock;
      if (!eqOrSame(listContents, lastListContents))
        clear();
      lastListContents = listContents;
    }
    ret super.get();
  }
}

Author comment

Began life as a copy of #1011310

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1018251
Snippet name: MechListDependentCache - depends on a single mech list
Eternal ID of this version: #1018251/4
Text MD5: 61f90f23f5a7681c42b376293f5732e6
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-03-16 19:39:59
Source code size: 523 bytes / 22 lines
Pitched / IR pitched: No / No
Views / Downloads: 418 / 1272
Version history: 3 change(s)
Referenced in: [show references]