// f is a function or an instance of Cache (the dependee) sclass DependentCache<A> extends Cache<A> { O depF, lastDep; *() {} *(O *maker, O *depF) {} A get() { if (hasLock(lock)) ret value; // Must be called from within maker { lock lock; O dep; if (depF instanceof Cache) dep = depF/Cache.changeCount; else { dep = callF(depF); if (dep instanceof Cache) dep = dep/Cache.changeCount; } if (neq(dep, lastDep)) { clear(); lastDep = dep; } } ret super.get(); } }
download show line numbers debug dex old transpilations
Travelled to 16 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, ppjhyzlbdabe, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1011310 |
Snippet name: | DependentCache |
Eternal ID of this version: | #1011310/6 |
Text MD5: | d505bfb8dcf5b87142e3bb1b2a877729 |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2018-07-22 12:04:33 |
Source code size: | 589 bytes / 25 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 500 / 2054 |
Version history: | 5 change(s) |
Referenced in: | [show references] |