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

12
LINES

< > BotCompany Repo | #1011644 // quickCache - singleton cached object per program

JavaX fragment (include)

1  
static O quickCache_value;
2  
sbool quickCache_set;
3  
static Lock quickCache_lock = lock();
4  
5  
static O quickCache(O f) {
6  
  lock quickCache_lock;
7  
  if (!quickCache_set) {
8  
    quickCache_set = true;
9  
    quickCache_value = callF(f);
10  
  }
11  
  ret quickCache_value;
12  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1011644
Snippet name: quickCache - singleton cached object per program
Eternal ID of this version: #1011644/4
Text MD5: c3ed8ac4934785e24bc551eb94390979
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-11-01 20:28:46
Source code size: 264 bytes / 12 lines
Pitched / IR pitched: No / No
Views / Downloads: 408 / 405
Version history: 3 change(s)
Referenced in: [show references]