Redis.Protocol.RESP2 (Redis v0.8.0)

Copy Markdown View Source

RESP2 protocol encoder and decoder (fallback for older Redis servers).

RESP2 uses the same array/bulk-string encoding for commands but has fewer response types than RESP3: simple strings, errors, integers, bulk strings, and arrays.

Summary

Functions

Decodes a RESP2 response from binary data. Returns {:ok, term, rest} or {:continuation, fun} if more data is needed.

Functions

decode(data)

@spec decode(binary()) ::
  {:ok, term(), binary()} | {:continuation, (binary() -> term())}

Decodes a RESP2 response from binary data. Returns {:ok, term, rest} or {:continuation, fun} if more data is needed.

encode(args)

See Redis.Protocol.RESP3.encode/1.

encode_pipeline(commands)

See Redis.Protocol.RESP3.encode_pipeline/1.