repository has now first level cache

This commit is contained in:
zadam
2020-04-06 20:59:04 +02:00
parent 081693f263
commit 5c0355718f
7 changed files with 45 additions and 20 deletions

View File

@@ -45,11 +45,7 @@ class Attribute extends Entity {
* @returns {Promise<Note|null>}
*/
async getNote() {
if (!this.__note) {
this.__note = await repository.getEntity("SELECT * FROM notes WHERE noteId = ?", [this.noteId]);
}
return this.__note;
return await repository.getNote(this.noteId);
}
/**
@@ -64,11 +60,7 @@ class Attribute extends Entity {
return null;
}
if (!this.__targetNote) {
this.__targetNote = await repository.getEntity("SELECT * FROM notes WHERE noteId = ?", [this.value]);
}
return this.__targetNote;
return await repository.getNote(this.value);
}
/**