@beyond-js/bundles-sdk
Version:
BeyondJS Bundles SDK
57 lines (48 loc) • 1.5 kB
JavaScript
module.exports = class {
constructor(analyzer) {
this.
}
async load() {
const {id} = this.
let row;
try {
const select = 'SELECT * FROM analyzers WHERE processor_id=?';
row = await this.
if (!row) return;
}
catch (exc) {
console.log('Error loading analyzer interfaces from cache:', exc.stack);
return;
}
try {
return JSON.parse(row.data);
}
catch (exc) {
console.log('Error loading analyzer interfaces from cache:', exc.stack);
await this.delete();
}
}
async save() {
const {id} = this.
try {
const data = JSON.stringify(this.
await this.
[]);
}
catch (exc) {
console.log('Error saving analyzer interfaces into cache:', exc.stack);
}
}
async delete() {
const {id} = this.
try {
const sentence = 'DELETE FROM analyzers WHERE processor_id=?';
await this.
}
catch (exc) {
console.log('Error deleting analyzer interfaces cache:', exc.stack);
}
}
}