net.resp.connection

*close*

dynamic

connection

added in 3.0

(connection {:keys [host port]})

creates a connection

(def |c| (connection {:host “localhost” :port 4456})) (connection? |c|) => true

(connection:close |c|)

connection-string

added in 3.0

(connection-string connection)

returns the string

connection:close

added in 3.0

(connection:close connection)

closes the connection

connection:health

added in 3.0

(connection:health connection)

checks on the health of the connection

(connection:health |conn|) => {:status :ok}

connection:info

added in 3.0

(connection:info connection)

outputs connection info

connection:process-bulk

added in 3.0

(connection:process-bulk connection inputs outputs _)

processes the returned responses

connection:process-single

added in 3.0

(connection:process-single _ data {:keys [format deserialize string]})

processes output data

connection:read

added in 3.0

(connection:read connection)

reads from the connection

connection:request-bulk

added in 3.0

(connection:request-bulk connection commands)(connection:request-bulk connection commands _)

sends a multi command to the connection

connection:request-single

added in 3.0

(connection:request-single connection command)(connection:request-single connection command _)

requests the connection command

connection:started?

added in 3.0

(connection:started? connection)

checks that connection has started

connection:stopped?

added in 3.0

(connection:stopped? connection)

checks that connection has stopped

connection:throw

added in 3.0

(connection:throw connection t)

writes an exception to the connection

connection:transact-combine

added in 3.0

(connection:transact-combine _ data)

not valid for rdp protocol

connection:transact-end

added in 3.0

(connection:transact-end connection)

command to end transaction

(connection:transact-end nil) => “EXEC”

connection:transact-start

added in 3.0

(connection:transact-start connection)

command to start transaction

(connection:transact-start nil) => “MULTI”

connection:value

added in 3.0

(connection:value connection val)

writes a string value to the connection

connection:write

added in 3.0

(connection:write connection input)

writes to the connection

connection?

added in 3.0

(connection? obj)

checks if instance is type connection

(connection? |conn|) => true

input-array

added in 3.0

(input-array command)

protects against wrong inputs

(seq (input-array 1 2 3)) => ’(“1” “2” “3”)

pipeline

added in 3.0

(pipeline connection)

retrieves the connection pipeline

pipeline:read

added in 3.0

(pipeline:read pipeline)

reads from the pipeline

pipeline:write

added in 3.0

(pipeline:write pipeline input)

sends a request tot the pipeline

pipeline?

added in 3.0

(pipeline? obj)

checks if object is instance of pipeline

test:activate

test:config

added in 3.0

(test:config)

creates a container and gets config

(test:config) => map?

test:connection

added in 3.0

(test:connection)(test:connection m)

creates a test connection

(test:connection) => connection?

test:deactivate

with-connection

macro

added in 3.0

(with-connection [conn opts] & body)

creates a temporary connection and runs code

(with-connection conn {:port 17001} (cc/bulk conn (fn [] (cc/req conn “FLUSHDB”) (cc/req conn “SET” “TEST:A” 1) (cc/req conn “KEYS” “*”)) {})) => [“OK” “OK” “TEST:A”]

with-test:connection

macro

added in 3.0

(with-test:connection conn & body)

creates an runs statements using a test connection

(with-connection conn {:port 17001} (cc/bulk conn (fn [] (cc/req conn “FLUSHDB”) (cc/req conn “SET” “TEST:A” 1) (cc/req conn “KEYS” “*”)) {})) => [“OK” “OK” “TEST:A”]