mirror of
https://gitlab.com/PronounsPage/PronounsPage.git
synced 2025-09-25 22:19:28 -04:00
[cache] disable on dev
This commit is contained in:
parent
4a595c20ae
commit
1469c30157
@ -9,6 +9,10 @@ export class CacheObject {
|
||||
}
|
||||
|
||||
async fetch(generator) {
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
return await generator();
|
||||
}
|
||||
|
||||
if (fs.existsSync(this.path) && fs.statSync(this.path).mtimeMs >= (new Date() - this.maxAgeMinutes*60*1000)) {
|
||||
const content = fs.readFileSync(this.path);
|
||||
return this.path.endsWith('.js') ? JSON.parse(content) : content;
|
||||
|
Loading…
x
Reference in New Issue
Block a user