fix(nbstore): fix indexer cache not working (#11922)
This commit is contained in:
@@ -265,6 +265,8 @@ export class DataStruct {
|
|||||||
if (cached) {
|
if (cached) {
|
||||||
return cached;
|
return cached;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const result = await (async () => {
|
||||||
using _ = await this.measure(`query[${query.type}]`);
|
using _ = await this.measure(`query[${query.type}]`);
|
||||||
if (query.type === 'match') {
|
if (query.type === 'match') {
|
||||||
const iidx = this.invertedIndex.get(table)?.get(query.field as string);
|
const iidx = this.invertedIndex.get(table)?.get(query.field as string);
|
||||||
@@ -299,6 +301,11 @@ export class DataStruct {
|
|||||||
return await iidx.all(trx);
|
return await iidx.all(trx);
|
||||||
}
|
}
|
||||||
throw new Error(`Query type '${query.type}' not supported`);
|
throw new Error(`Query type '${query.type}' not supported`);
|
||||||
|
})();
|
||||||
|
|
||||||
|
cache.set(query, result);
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
async clear(trx: DataStructRWTransaction) {
|
async clear(trx: DataStructRWTransaction) {
|
||||||
|
|||||||
Reference in New Issue
Block a user