Skip to content

Use JSON.MGET for repo.fetch multiple ids #256

@chiawendt

Description

@chiawendt

Currently repo.fetch(ids) translates to awaiting multiple JSON.GET. Performance might be improved by replacing JSON.GET with JSON.MGET.

private async readEntitiesFromJson(ids: string[]): Promise<T[]> {
return Promise.all(
ids.map(async (entityId): Promise<T> => {
const keyName = this.makeKey(entityId)
const jsonData = await this.client.jsonget(keyName) ?? {}
const entityData = fromRedisJson(this.#schema, jsonData)
return {...entityData, [EntityId]: entityId, [EntityKeyName]: keyName} as T
}))
}

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions