Execute a single command and return its Redis response value.
Example:
let reply ← client.execute (Command.ping ()).request
Equations
- One or more equations did not get rendered due to their size.
Instances For
Execute a pipeline.
Example:
(a,b,_) ← client.runPipeline <| Pipeline.empty |>.get "hello" |>.set "bar" "baz" |>.get "bar"
Equations
- One or more equations did not get rendered due to their size.
Instances For
Create a new client value for the given transport type without opening a connection.
Example:
let client : LeanRedis.Client MyTransport ← LeanRedis.Client.new cfg
Equations
- LeanRedis.Client.new config = do let state ← liftM (Std.Mutex.new { config := config }) let subscribers ← liftM (Std.Mutex.new { }) pure { state := state, subscribers := subscribers }
Instances For
Create a new client using the default TCP transport without opening a connection.
Example:
let client ← LeanRedis.Client.newDefault {
endpoint := { host := "127.0.0.1", port := 6379 }
}
Equations
- LeanRedis.Client.newDefault config = LeanRedis.Client.new config
Instances For
Open the transport and run Redis bootstrap for an existing client.
If a reconnect wait is in progress, this cancels it logically and tries immediately.
Example:
let _ ← client.connect
Equations
- One or more equations did not get rendered due to their size.
Instances For
Close the current connection and stop background reconnects until a later explicit connect.
Example:
let _ ← client.disconnect
Equations
- One or more equations did not get rendered due to their size.
Instances For
Return true when the client currently has a ready runtime.
Example:
let connected ← client.isConnected
Equations
- client.isConnected = do let state ← LeanRedis.Client.getState✝ client pure state.session.isReady
Instances For
Return the current lifecycle status of the client.
Example:
let status ← client.connectionStatus
Equations
- client.connectionStatus = do let state ← LeanRedis.Client.getState✝ client pure state.session.phase
Instances For
Fail with an unavailable error unless the client is connected.
Example:
let _ ← client.requireConnected
Equations
- One or more equations did not get rendered due to their size.
Instances For
Read the current internal connection state tracked by the client.
Example:
let state ← client.currentState
Equations
- client.currentState = do let state ← LeanRedis.Client.getState✝ client pure state.session
Instances For
Subscribe an async handler to client connection lifecycle events.
Returns a subscription id that can later be passed to offEvent.
Example:
let sub ← client.onEvent fun event => do
IO.println s!"{repr event}"
Equations
- One or more equations did not get rendered due to their size.
Instances For
Remove a previously registered event handler.
Example:
let sub ← client.onEvent fun _ => pure ()
client.offEvent sub
Equations
- One or more equations did not get rendered due to their size.