A fully open source & end-to-end encrypted note taking alternative to Evernote.
TypeScript asp-net-coredotnet-coreelectronfosshacktoberfestnote-managmentnote-takingnote-taking-appnotebooknotesnotes-appopen-sourceopensourceprivacyproductivityreactreact-nativereactjsself-hosted
perf: add readMulti for reading multiple keys
thecodrra88552cea332
diff --git a/packages/core/database/cached-collection.js b/packages/core/database/cached-collection.jsindex 1c08cfcd3..f5c24317a 100644--- a/packages/core/database/cached-collection.js+++ b/packages/core/database/cached-collection.js@@ -10,9 +10,8 @@ export default class CachedCollection {async init() {await this.indexer.init();- for (let id of this.indexer.indices) {- this.map.set(id, await this.indexer.read(id));- }+ const data = await this.indexer.readMulti(this.indexer.indices);+ this.map = new Map(data);}/**diff --git a/packages/core/database/storage.js b/packages/core/database/storage.jsindex dc11bd610..91cb72216 100644--- a/packages/core/database/storage.js+++ b/packages/core/database/storage.js@@ -2,18 +2,20 @@ export default class Storage {constructor(context) {this.storage = context;}- async write(key, data) {- await this.storage.write(key, data);+ write(key, data) {+ return this.storage.write(key, data);}- async read(key) {- let data = await this.storage.read(key);- return data;+ readMulti(keys) {+ return this.storage.readMulti(keys);}- async clear() {- await this.storage.clear();+ read(key) {+ return this.storage.read(key);}- async remove(key) {- await this.storage.remove(key);+ clear() {+ return this.storage.clear();+ }+ remove(key) {+ return this.storage.remove(key);}encrypt(password, data) {return this.storage.encrypt(password, data);