Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why does mget has two parameters? #62

Open
metehus opened this issue Jul 7, 2022 · 0 comments
Open

Why does mget has two parameters? #62

metehus opened this issue Jul 7, 2022 · 0 comments

Comments

@metehus
Copy link

metehus commented Jul 7, 2022

The mget method has two parameters:

  /**
   * Returns the values of all specified keys. For every key that does not hold a string value or does not
   * exist, the special value nil is returned. Because of this, the operation never fails.
   *
   * @param key The key.
   * @param keys The other key.
   * @returns List of values at the specified keys.
   */
  public mget(key: string, ...keys: string[]) {
    return this.command<Array<string | number | null>>("MGET", key, ...keys);
  }

But shouldn't it be only one? this just seems weird and is very bad to use this method, having to do something like this:

  public async getManyObjects (keys: string[]) {
    return tedisClient.mget('_', ...keys).then(list => list.slice(1))
  }

Suggested behaviour

I would suggest to remove or concat the first key parameter, so we could use it like this:

  public async getManyObjects (keys: string[]) {
    return tedisClient.mget(...keys)
  }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant