-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Open
Description
Motivation
Currently, Redis values are returned as Buffer, which requires manual conversion or copying when sending data to worker_threads.
To enable zero-copy transfer, it would be great to support Uint8Array as a return type.
Internally, the implementation may use new TextEncoder().encode(redisRes)
or similar logic when encoding strings to Uint8Array.
Basic Code Example
const redis = await createClient({ url: 'redis://localhost:7777' })
.on("error", (err) => console.log("Redis Client Error", err))
.connect();
const rawData = await fs.readFile('./package.json');
await redis.set('__foo1', rawData);
const res = await redis.withTypeMapping({
[RESP_TYPES.BLOB_STRING]: Uint8Array,
}).get('__foo1');
worker.postMessage(res, [res.buffer]);
Metadata
Metadata
Assignees
Labels
No labels