Documentation

LeanRedis.Client.Hash

Get the value of a hash field.

Example:

let value ← client.hGet "user:1" "name"
Equations
Instances For

    Set one or more hash fields.

    Example:

    let changed ← client.hSet "user:1" #[("name", "alice")]
    
    Equations
    Instances For

      Get multiple hash fields.

      Example:

      let values ← client.hMGet "user:1" #["name", "role"]
      
      Equations
      Instances For

        Set multiple hash fields with HMSET.

        Example:

        let _ ← client.hMSet "user:1" #[("name", "alice"), ("role", "admin")]
        
        Equations
        Instances For

          Get all hash fields and values.

          Example:

          let entries ← client.hGetAll "user:1"
          
          Equations
          Instances For

            Delete one or more hash fields.

            Example:

            let removed ← client.hDel "user:1" #["role"]
            
            Equations
            Instances For

              Check whether a hash field exists.

              Example:

              let exists ← client.hExists "user:1" "name"
              
              Equations
              Instances For

                Return the number of fields in a hash.

                Example:

                let len ← client.hLen "user:1"
                
                Equations
                Instances For

                  Return all hash field names.

                  Example:

                  let keys ← client.hKeys "user:1"
                  
                  Equations
                  Instances For

                    Return all hash values.

                    Example:

                    let vals ← client.hVals "user:1"
                    
                    Equations
                    Instances For

                      Return the string length of a hash field value.

                      Example:

                      let len ← client.hStrLen "user:1" "name"
                      
                      Equations
                      Instances For
                        def LeanRedis.Client.hIncrBy {τ : Type} [Transport.Transport τ] (client : Client τ) (key field : String) (amount : Int) :

                        Increment a hash integer field.

                        Example:

                        let value ← client.hIncrBy "stats" "count" 1
                        
                        Equations
                        Instances For

                          Increment a hash numeric field by a decimal amount.

                          Example:

                          let value ← client.hIncrByFloat "stats" "score" "1.5"
                          
                          Equations
                          • One or more equations did not get rendered due to their size.
                          Instances For

                            Set a hash field only if it does not exist.

                            Example:

                            let stored ← client.hSetNx "user:1" "name" "alice"
                            
                            Equations
                            Instances For

                              Return one random hash field.

                              Example:

                              let field ← client.hRandField "user:1"
                              
                              Equations
                              Instances For

                                Return random hash fields.

                                Example:

                                let fields ← client.hRandFields "user:1" 2
                                
                                Equations
                                Instances For

                                  Return random hash fields with values.

                                  Example:

                                  let entries ← client.hRandFieldsWithValues "user:1" 2
                                  
                                  Equations
                                  • One or more equations did not get rendered due to their size.
                                  Instances For

                                    Scan a hash incrementally.

                                    Example:

                                    let page ← client.hScan "user:1" 0
                                    
                                    Equations
                                    Instances For