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