Documentation

LeanRedis.Client.Basic

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
      def LeanRedis.Client.new {τ : Type} [Transport.Transport τ] (config : Config) :
      IO (Client τ)

      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
      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
        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
              Instances For

                Return the current lifecycle status of the client.

                Example:

                let status ← client.connectionStatus
                
                Equations
                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
                    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
                        def LeanRedis.Client.offEvent {τ : Type} (client : Client τ) (subscriptionId : ClientEventSubscriptionId) :

                        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.
                        Instances For