(key, value, ttl = this.ttl)
| 56 | } |
| 57 | |
| 58 | async put(key, value, ttl = this.ttl) { |
| 59 | value = JSON.stringify(value); |
| 60 | debug('put', { key, value, ttl }); |
| 61 | await this.queue.enqueue(key); |
| 62 | if (ttl === 0) { |
| 63 | // ttl of zero is a logical no-op, but redis cannot set expire time of zero |
| 64 | return; |
| 65 | } |
| 66 | |
| 67 | if (ttl === Infinity) { |
| 68 | return this.client.set(key, value); |
| 69 | } |
| 70 | |
| 71 | if (!isValidTTL(ttl)) { |
| 72 | ttl = this.ttl; |
| 73 | } |
| 74 | return this.client.set(key, value, { PX: ttl }); |
| 75 | } |
| 76 | |
| 77 | async del(key) { |
| 78 | debug('del', { key }); |
nothing calls this directly
no test coverage detected