【问题标题】:How to do pipelining with RedisJSON (node's iorejson)?如何使用 RedisJSON(节点的 iorejson)进行流水线操作?
【发布时间】:2022-11-26 09:01:27
【问题描述】:

我已经使用 RedisJSON 几天了,但我找不到任何关于如何使用节点的“iorejson”包进行流水线操作的信息。

如果使用,有人可以指出我的方向吗?

【问题讨论】:

    标签: redis pipelining redisjson


    【解决方案1】:

    看起来 iorejson 没有维护,我建议你移动到 node-redisioredis

    node-redis

    // npm install redis
    
    import { createClient } from 'redis';
    
    const client = createClient();
    client.on('error', err => console.error('Redis Client Error', err));
    
    await client.connect();
    
    const replies = await client.multi()
      .json.set('key', { field: 'value' })
      .json.get('key', '$')
      .exec();
    

    ioredis

    // npm install ioredis
    
    import Redis from 'ioredis';
    
    const client = new Redis();
    client.on('error', err => console.error('Redis Client Error', err));
    
    await client.connect();
    
    const replies = await client.multi()
      .call('JSON.SET', 'key', JSON.stringify({ field: 'value' }))
      .call('JSON.GET', 'key', '$')
      .exec();
    
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-10-09
      • 1970-01-01
      相关资源
      最近更新 更多