@beyond-js/bundles-sdk
Version:
BeyondJS Bundles SDK
58 lines (49 loc) • 1.56 kB
JavaScript
module.exports = class {
constructor(compiler) {
this.
}
async load() {
const {id} = this.
let row;
try {
const select = 'SELECT * FROM compilations WHERE processor_id=?';
row = await this.
}
catch (exc) {
console.log('Error loading compiler compilation from cache:', exc.stack);
return;
}
if (!row) return;
try {
return JSON.parse(row.data);
}
catch (exc) {
console.log('Error loading compiler compilation 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 compiler compilation into cache:', exc.stack);
}
}
async delete() {
const {processor} = this.
try {
const sentence = 'DELETE FROM compilations WHERE processor_id=?';
await this.
}
catch (exc) {
console.log('Error deleting compiler compilation cache:', exc.stack);
}
}
}