(key)
| 7 | } |
| 8 | |
| 9 | get(key) { |
| 10 | const record = this.cache[key]; |
| 11 | if (record == null) { |
| 12 | return null; |
| 13 | } |
| 14 | |
| 15 | // Has Record and isnt expired |
| 16 | if (isNaN(record.expire) || record.expire >= Date.now()) { |
| 17 | return record.value; |
| 18 | } |
| 19 | |
| 20 | // Record has expired |
| 21 | delete this.cache[key]; |
| 22 | return null; |
| 23 | } |
| 24 | |
| 25 | put(key, value, ttl = this.ttl) { |
| 26 | if (ttl < 0 || isNaN(ttl)) { |
nothing calls this directly
no outgoing calls
no test coverage detected