Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Response

The response received from the REDIS server. Redis responses can have several representations:

  • simple string - C string
  • integer - 64bit integer value
  • bulk - byte array
  • multi - list

Due to the dynamic nature the response object will try to cast the received response to the desired type. A special case should be noted that multi responses are also handled by the response object as it implements the iterable interface. So in this case constructs like for loops on the response will give you access to the underlying elements.

Hierarchy

  • Response

Index

Methods

attributes

  • attributes(): {}
  • RESP3 responses may include attributes

    Returns {}

containsKey

  • containsKey(key: string): boolean
  • Does this multi response contains a string key. Note that REDIS does not support strings as keys but by convention it encodes hashes in lists where index i is the key, and index i+1 is the value.

    Parameters

    • key: string

    Returns boolean

get

  • Get this multi response value at a numerical index.

    Parameters

    • index: number

    Returns Response

  • Get this multi response value at a string key. Note that REDIS does not support strings as keys but by convention it encodes hashes in lists where index i is the key, and index i+1 is the value.

    Parameters

    • key: string

    Returns Response

getKeys

  • getKeys(): string
  • Get this multi response keys from a hash. Note that REDIS does not support strings as keys but by convention it encodes hashes in lists where index i is the key, and index i+1 is the value.

    Returns string

size

  • size(): number
  • Get this size of this multi response.

    Returns number

toBigInteger

  • toBigInteger(): any
  • Get this response as a BigInteger.

    Returns any

toBoolean

  • toBoolean(): boolean
  • Get this response as a Boolean.

    Returns boolean

toBuffer

  • toBuffer(): Buffer
  • Get this response as Buffer.

    Returns Buffer

toByte

  • toByte(): number
  • Get this response as a Byte.

    Returns number

toBytes

  • toBytes(): number[]
  • Get this response as a byte[].

    Returns number[]

toDouble

  • toDouble(): number
  • Get this response as a Double.

    Returns number

toFloat

  • toFloat(): number
  • Get this response as a Float.

    Returns number

toInteger

  • toInteger(): number
  • Get this response as a Integer.

    Returns number

toLong

  • toLong(): number
  • Get this response as a Long.

    Returns number

toNumber

  • toNumber(): any
  • Get this response as a Number. In contrast to other numeric getters, this will not perform any conversion if the underlying type is not numeric.

    Returns any

toShort

  • toShort(): number
  • Get this response as a Short.

    Returns number

toString

  • toString(): string
  • toString(encoding: any): string
  • Get this response as a String.

    Returns string

  • Get this response as a String encoded with the given charset.

    Parameters

    • encoding: any

    Returns string

type

  • The response return type.

    Returns ResponseType

Generated using TypeDoc