|
@@ -6,7 +6,7 @@ const connManager = require('../db/connManager');
|
|
class ReaderStorage {
|
|
class ReaderStorage {
|
|
constructor() {
|
|
constructor() {
|
|
this.storagePool = connManager.pool.readerStorage;
|
|
this.storagePool = connManager.pool.readerStorage;
|
|
- this.cache = {};
|
|
|
|
|
|
+ this.periodicCleanCache(3*3600*1000);//1 раз в 3 часа
|
|
}
|
|
}
|
|
|
|
|
|
async doAction(act) {
|
|
async doAction(act) {
|
|
@@ -92,6 +92,14 @@ class ReaderStorage {
|
|
|
|
|
|
return {state: 'success'};
|
|
return {state: 'success'};
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ periodicCleanCache(timeout) {
|
|
|
|
+ this.cache = {};
|
|
|
|
+
|
|
|
|
+ setTimeout(() => {
|
|
|
|
+ this.periodicCleanCache(timeout);
|
|
|
|
+ }, timeout);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
const readerStorage = new ReaderStorage();
|
|
const readerStorage = new ReaderStorage();
|