perf(api): parallelize Redis cache reads

Fetch the stream value and its type metadata concurrently to reduce cache-read latency by one Redis round trip.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
Work 2026-09-29 15:22:39 -05:00
parent a636575b09
commit 0ff9e49d00

View file

@ -26,11 +26,14 @@ export default class RedisStore extends Store {
async _get(key) {
await this.#connected;
const valueType = await this.#client.get(this.#keyOf(key) + '_t');
const value = await this.#client.get(
commandOptions({ returnBuffers: true }),
this.#keyOf(key)
);
const redisKey = this.#keyOf(key);
const [valueType, value] = await Promise.all([
this.#client.get(redisKey + '_t'),
this.#client.get(
commandOptions({ returnBuffers: true }),
redisKey
)
]);
if (!value) {
return null;