MCPcopy Index your code
hub / github.com/Moli-X/Resources / persistCache

Method persistCache

Script/Hzh.js:377–399  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

375
376 // store cache
377 persistCache() {
378 const data = JSON.stringify(this.cache, null, 2);
379 if (isQX) $prefs.setValueForKey(data, this.name);
380 if (isLoon || isSurge) $persistentStore.write(data, this.name);
381 if (isNode) {
382 this.node.fs.writeFileSync(
383 `${this.name}.json`,
384 data,
385 {
386 flag: "w",
387 },
388 (err) => console.log(err)
389 );
390 this.node.fs.writeFileSync(
391 "root.json",
392 JSON.stringify(this.root, null, 2),
393 {
394 flag: "w",
395 },
396 (err) => console.log(err)
397 );
398 }
399 }
400
401 write(data, key) {
402 this.log(`SET ${key}`);

Callers 9

writeMethod · 0.80
deleteMethod · 0.80
SubOne.jsFile · 0.80
SubZero.jsFile · 0.80
_gistBackupFunction · 0.80
sub-store-0.min.jsFile · 0.80
_gistBackupFunction · 0.80
sub-store-1.min.jsFile · 0.80

Calls 3

stringifyMethod · 0.45
writeMethod · 0.45
logMethod · 0.45

Tested by

no test coverage detected