Open amochkin opened 7 months ago
const redis = require('redis');
const client = redis.createClient();
const commands = [
client.set('key1', 'value1'),
client.set('key2', 'value2'),
client.set('key3', 'value3')
];
const buffer = Buffer.alloc(0);
commands.forEach(command => {
const commandBuffer = Buffer.from(command);
buffer = Buffer.concat([buffer, commandBuffer]);
});
client.send_command('MULTI', [buffer], (err, res) => {
if (err) {
console.error('Error sending commands:', err);
} else {
console.log('Commands sent successfully:', res);
}
});
Hi, @everyone!
Can someone please explain why is this happening:
https://github.com/redis/node-redis/blob/4f85030e42da2eed6a178e54994330af5062761e/index.js#L896-L899
Let`s concatenate the data and send once.