(data, flushNow)
| 73 | }, |
| 74 | |
| 75 | async set(data, flushNow) { |
| 76 | const toWrite = {}; |
| 77 | const keys = []; |
| 78 | cache.batch(true); |
| 79 | data::forEachEntry(([key, val]) => { |
| 80 | const copy = deepCopyDiff(val, cache.get(key)); |
| 81 | if (copy !== undefined) { |
| 82 | cache.put(key, copy); |
| 83 | dbKeys.set(key, 1); |
| 84 | keys.push(key); |
| 85 | if (undoing) { |
| 86 | toWrite[key] = val; |
| 87 | return; |
| 88 | } |
| 89 | if (!flushNow && key.startsWith(S_VALUE_PRE)) { |
| 90 | valuesToFlush[key] = copy; |
| 91 | } else { |
| 92 | toWrite[key] = val; |
| 93 | if (key.startsWith(S_SCRIPT_PRE) && updateScriptMap(key, val) && val[INFERRED]) { |
| 94 | delete (toWrite[key] = { ...val })[INFERRED]; |
| 95 | } |
| 96 | updateScriptSizeContributor(key, val); |
| 97 | } |
| 98 | } |
| 99 | }); |
| 100 | cache.batch(false); |
| 101 | if (!isEmpty(toWrite)) await api.set(toWrite); |
| 102 | if (undoing) return; |
| 103 | if (keys.length) fire(keys, data); |
| 104 | flushLater(); |
| 105 | }, |
| 106 | |
| 107 | async remove(keys) { |
| 108 | const toDelete = keys.filter(key => { |
nothing calls this directly
no test coverage detected