Skip to content

Why does mget has two parameters? #62

@metehus

Description

@metehus

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)
  }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions