Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Request

Builder for REDIS requests that will be encoded according to the RESP protocol was introduced in Redis 1.2. Which became the standard way for talking with the Redis server in Redis 2.0.

Redis protocol documentation states:

Clients send commands to a Redis server as a RESP Array of Bulk Strings.

So all non String/Bulk types will be encoded to Bulk for convenience.

Hierarchy

  • Request

Index

Methods

arg

  • Adds a String argument using UTF8 character encoding

    Parameters

    • arg: string

    Returns Request

  • Adds a String using a specific character encoding argument

    Parameters

    • arg: string
    • enc: string

    Returns Request

  • Adds a String key argument

    Parameters

    • arg: Buffer

    Returns Request

  • Adds a long encoded to string

    Parameters

    • arg: number

    Returns Request

  • Adds a boolean encoded to string

    Parameters

    • arg: boolean

    Returns Request

  • Adds a JsonObject argument, the encoding will serialize the json as key0, value0, key1, value1, ... keyN, valueN. This is a non-optimized serialization and will just use the string encoding of the values for non buffers.

    All null values will follow the encoding rules of {@link Request#nullArg}.

    Parameters

    • arg: {}
      • [key: string]: any

    Returns Request

  • Adds a JsonArray argument, the encoding will serialize the json as value0, value1, ... valueN. This is a non-optimized serialization and will just use the string encoding of the values for non buffers.

    All null values will follow the encoding rules of {@link Request#nullArg}.

    Parameters

    • arg: any[]

    Returns Request

  • Adds a byte array

    Parameters

    • arg: number[]

    Returns Request

  • Adds a int encoded to string

    Parameters

    • arg: number

    Returns Request

  • Adds a short encoded to string

    Parameters

    • arg: number

    Returns Request

  • Adds a byte encoded to string

    Parameters

    • arg: number

    Returns Request

  • Adds a float encoded to string

    Parameters

    • arg: number

    Returns Request

  • Adds a double encoded to string

    Parameters

    • arg: number

    Returns Request

command

  • Get the Command that is to be used by this request.

    Returns Command

nullArg

  • Returns Request

Static cmd

  • Creates a new request command. Requests can be reused to avoid GC.

    Parameters

    Returns Request

  • Creates a new request command only with simple types: Number, Boolean, String, byte[] or . This factory reduces the GC as it allocates the arguments array with the right size.

    Parameters

    Returns Request

Generated using TypeDoc