OpenFn/adaptors

Add `mGet()` and `mSet()` function to `redis` adaptor

Open

#731 opened on Aug 21, 2024

View on GitHub
 (0 comments) (0 reactions) (0 assignees)JavaScript (35 forks)auto 404
good first issue

Repository metrics

Stars
 (21 stars)
PR merge metrics
 (PR metrics pending)

Description

Background

The redis adaptor supports basic Redis commands, it lacks support for the mGet() and mSet() commands, which are essential for efficiently handling multiple key-value pairs in Redis.

Feature Request

I propose adding two new helper methods to the Redis adaptor: mGet() and mSet(). These methods should mirror the functionality of Redis's native json.mGet and json.mSet commands, allowing us to retrieve and set multiple key-value pairs in a single operation.

Implementation Details

  1. mGet(keys: Array<string>):

    • Accepts an array of strings, where each string is a key in Redis.
    • Returns an array of values corresponding to the provided keys.
  2. mSet(keyValuePairs: Object):

    • Accepts an object where each key-value pair corresponds to a Redis key and its associated value.
    • Sets all the key-value pairs in Redis in a single operation.

Use Cases

  • mGet(): This will be particularly useful when retrieving multiple related values from Redis in a single call, reducing the need for multiple jGet operations and improving performance.
  • mSet(): This will allow us to efficiently store multiple key-value pairs at once, which is beneficial when working with bulk data.

Redis Docs

Contributor guide