taoensso.carmine.protocol

Core facilities for communicating with Redis servers using the Redis
request/response protocol, Ref. http://redis.io/topics/protocol.

*context*

dynamic

Current dynamic Context

*nested-stash-consumed?_*

dynamic

*nested-stashed-reqs*

dynamic

*parser*

dynamic

ifn (with optional meta) or nil

-with-replies

(-with-replies body-fn as-pipeline?)
Implementation detail

execute-requests

(execute-requests get-replies? as-pipeline?)(execute-requests conn requests get-replies? as-pipeline?)
Implementation detail.
Sends given/dynamic requests to given/dynamic Redis server and optionally
blocks to receive the relevant queued (pipelined) parsed replies.

get-parsed-reply

(get-parsed-reply in ?parser)
Implementation detail

get-unparsed-reply

(get-unparsed-reply in req-opts)
Implementation detail.
BLOCKS to receive a single reply from Redis server and returns the result as
[<type> <reply>]. Redis will reply to commands with different kinds of replies,
identified by their first byte, Ref. http://redis.io/topics/protocol:

  * `+` for simple strings -> <string>
  * `:` for integers       -> <long>
  * `-` for error strings  -> <ex-info>
  * `$` for bulk strings   -> <clj>/<raw-bytes>    ; Marked as serialized
                           -> <bytes>/<raw-bytes>  ; Marked as binary
                           -> <string>/<raw-bytes> ; Unmarked
                           -> nil
  * `*` for arrays         -> <vector>
                           -> nil

IByteStr

protocol

members

byte-str

(byte-str x)
Coerces arbitrary Clojure val to Redis bytestring

no-context-ex

parse

macro

(parse f & body)
Wraps body so that replies to any wrapped Redis commands will be parsed with
`(f reply)`. Replaces any current parser; removes parser when `f` is nil.
See also `parser-comp`.

parse-nippy

macro

(parse-nippy thaw-opts & body)

parse-raw

macro

(parse-raw & body)

parser-comp

(parser-comp f g)
Composes parsers when f or g are nnil, preserving metadata

possible-nippy-bytes?

(possible-nippy-bytes? x)

raw

(raw x)
Forces byte[] argument to be sent to Redis as raw, unencoded bytes.

return

Takes values and returns them as part of next reply from Redis server.
Unlike `echo`, does not actually send any data to Redis.

return-parsed-replies

(return-parsed-replies preplies as-pipeline?)
Implementation detail

suppressed-reply-kw

with-context

macro

(with-context conn & body)
Implementation detail

with-replies

macro

(with-replies :as-pipeline & body)(with-replies & body)
Alpha - subject to change.
Evaluates body, immediately returning the server's response to any
contained Redis commands (i.e. before enclosing context ends).

As an implementation detail, stashes and then `return`s any replies already
queued with Redis server: i.e. should be compatible with pipelining.

Note on parsers: if you're writing a Redis command (e.g. a fn that is
intended to execute w/in an implicit connection context) and you're using
`with-replies` as an implementation detail (i.e. you're interpreting
replies internally), you probably want `(parse nil (with-replies ...))` to
keep external parsers from leaking into your internal logic.