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)

1  
2  
sclass MechListDependentCache<A> extends Cache<A> {
3  
  // maker is now F1<S, A>
4  
  S listName, lastListContents;
5  
  
6  
  *() {}
7  
  *(S *listName, O *maker) {}
8  
  
9  
  A make() { ret (A) callF(maker, lastListContents); }
10  
  
11  
  A get() {
12  
    if (hasLock(lock)) ret value; // Must be called from within maker
13  
    {
14  
      S listContents = mL_raw(listName);
15  
      lock lock;
16  
      if (!eqOrSame(listContents, lastListContents))
17  
        clear();
18  
      lastListContents = listContents;
19  
    }
20  
    ret super.get();
21  
  }
22  
}

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: 421 / 1276
Version history: 3 change(s)
Referenced in: [show references]