Добавил периодическую очистку кэша
This commit is contained in:
@@ -6,7 +6,7 @@ const connManager = require('../db/connManager');
|
||||
class ReaderStorage {
|
||||
constructor() {
|
||||
this.storagePool = connManager.pool.readerStorage;
|
||||
this.cache = {};
|
||||
this.periodicCleanCache(3*3600*1000);//1 раз в 3 часа
|
||||
}
|
||||
|
||||
async doAction(act) {
|
||||
@@ -92,6 +92,14 @@ class ReaderStorage {
|
||||
|
||||
return {state: 'success'};
|
||||
}
|
||||
|
||||
periodicCleanCache(timeout) {
|
||||
this.cache = {};
|
||||
|
||||
setTimeout(() => {
|
||||
this.periodicCleanCache(timeout);
|
||||
}, timeout);
|
||||
}
|
||||
}
|
||||
|
||||
const readerStorage = new ReaderStorage();
|
||||
|
||||
Reference in New Issue
Block a user