1 | sclass ExpiringValue<A> { |
2 | A value; |
3 | long expires; // in sysNow() time |
4 | |
5 | *() {} |
6 | *(A *value, long expiryTime) { expires = sysNow()+expiryTime; } |
7 | |
8 | A get() { |
9 | checkExpiry(); |
10 | ret value; |
11 | } |
12 | |
13 | void checkExpiry { |
14 | if (sysNow() > expires) |
15 | value = null; |
16 | } |
17 | } |
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: | 365 / 899 |
Referenced in: | [show references] |