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)

static O quickCache_value;
sbool quickCache_set;
static Lock quickCache_lock = lock();

static O quickCache(O f) {
  lock quickCache_lock;
  if (!quickCache_set) {
    quickCache_set = true;
    quickCache_value = callF(f);
  }
  ret quickCache_value;
}

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