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

format

  • format(): string | null
  • RESP3 Verbatim Bulk message include a 3 character format.

    Returns string | null

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 | null
  • Get this response as a BigInteger.

    Returns any | null

toBoolean

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

    Returns boolean | null

toBuffer

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

    Returns Buffer

toByte

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

    Returns number | null

toBytes

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

    Returns number[]

toDouble

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

    Returns number | null

toFloat

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

    Returns number | null

toInteger

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

    Returns number | null

toLong

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

    Returns number | null

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 | null
  • Get this response as a Short.

    Returns number | null

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