mirror of
https://github.com/misenhower/splatoon3.ink.git
synced 2026-04-25 07:18:35 -05:00
Move cache files to their own directory
This commit is contained in:
parent
084793948f
commit
314d61ecb4
|
|
@ -1,5 +1,6 @@
|
|||
import fs from 'fs/promises';
|
||||
|
||||
import path from 'path';
|
||||
import mkdirp from 'mkdirp';
|
||||
export default class ValueCache
|
||||
{
|
||||
constructor(key) {
|
||||
|
|
@ -7,7 +8,7 @@ export default class ValueCache
|
|||
}
|
||||
|
||||
get path() {
|
||||
return `storage/${this._key}.json`;
|
||||
return `storage/cache/${this._key}.json`;
|
||||
}
|
||||
|
||||
async _getRawItem() {
|
||||
|
|
@ -40,6 +41,7 @@ export default class ValueCache
|
|||
async setData(data, expires = null) {
|
||||
let serialized = JSON.stringify({ expires, data }, undefined, 2);
|
||||
|
||||
await mkdirp(path.dirname(this.path));
|
||||
await fs.writeFile(this.path, serialized);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
1
package-lock.json
generated
1
package-lock.json
generated
|
|
@ -11,6 +11,7 @@
|
|||
"cron": "^2.1.0",
|
||||
"dotenv": "^16.0.2",
|
||||
"ecstatic": "^4.1.4",
|
||||
"mkdirp": "^1.0.4",
|
||||
"nxapi": "^1.4.0",
|
||||
"pinia": "^2.0.13",
|
||||
"puppeteer": "^17.0.0",
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@
|
|||
"cron": "^2.1.0",
|
||||
"dotenv": "^16.0.2",
|
||||
"ecstatic": "^4.1.4",
|
||||
"mkdirp": "^1.0.4",
|
||||
"nxapi": "^1.4.0",
|
||||
"pinia": "^2.0.13",
|
||||
"puppeteer": "^17.0.0",
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user