sclass ExpiringValue<A> { A value; long expires; // in sysNow() time *() {} *(A *value, long expiryTime) { expires = sysNow()+expiryTime; } A get() { checkExpiry(); ret value; } void checkExpiry { if (sysNow() > expires) value = null; } }
download show line numbers debug dex old transpilations
Travelled to 13 computer(s): bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv
No comments. add comment
Snippet ID: | #1019166 |
Snippet name: | ExpiringValue (don't persist) |
Eternal ID of this version: | #1019166/1 |
Text MD5: | 5813358c1c562e6ce5484d65b57b5548 |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2018-10-26 15:15:23 |
Source code size: | 298 bytes / 17 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 366 / 899 |
Referenced in: | #1034167 - Standard Classes + Interfaces (LIVE, continuation of #1003674) |