def
LeanRedis.Client.hGet
{τ : Type}
[Transport.Transport τ]
(client : Client τ)
(key field : String)
:
Get the value of a hash field.
Example:
let value ← client.hGet "user:1" "name"
Equations
- client.hGet key field = do let reply ← client.execute (LeanRedis.Command.hGet key field).request liftM ((LeanRedis.Command.hGet key field).decode reply)
Instances For
def
LeanRedis.Client.hSet
{τ : Type}
[Transport.Transport τ]
(client : Client τ)
(key : String)
(entries : Array (String × String))
:
Set one or more hash fields.
Example:
let changed ← client.hSet "user:1" #[("name", "alice")]
Equations
- client.hSet key entries = do let reply ← client.execute (LeanRedis.Command.hSet key entries).request liftM ((LeanRedis.Command.hSet key entries).decode reply)
Instances For
def
LeanRedis.Client.hMGet
{τ : Type}
[Transport.Transport τ]
(client : Client τ)
(key : String)
(fields : Array String)
:
Get multiple hash fields.
Example:
let values ← client.hMGet "user:1" #["name", "role"]
Equations
- client.hMGet key fields = do let reply ← client.execute (LeanRedis.Command.hMGet key fields).request liftM ((LeanRedis.Command.hMGet key fields).decode reply)
Instances For
def
LeanRedis.Client.hMSet
{τ : Type}
[Transport.Transport τ]
(client : Client τ)
(key : String)
(entries : Array (String × String))
:
Set multiple hash fields with HMSET.
Example:
let _ ← client.hMSet "user:1" #[("name", "alice"), ("role", "admin")]
Equations
- client.hMSet key entries = do let reply ← client.execute (LeanRedis.Command.hMSet key entries).request liftM ((LeanRedis.Command.hMSet key entries).decode reply)
Instances For
def
LeanRedis.Client.hGetAll
{τ : Type}
[Transport.Transport τ]
(client : Client τ)
(key : String)
:
Get all hash fields and values.
Example:
let entries ← client.hGetAll "user:1"
Equations
- client.hGetAll key = do let reply ← client.execute (LeanRedis.Command.hGetAll key).request liftM ((LeanRedis.Command.hGetAll key).decode reply)
Instances For
def
LeanRedis.Client.hDel
{τ : Type}
[Transport.Transport τ]
(client : Client τ)
(key : String)
(fields : Array String)
:
Delete one or more hash fields.
Example:
let removed ← client.hDel "user:1" #["role"]
Equations
- client.hDel key fields = do let reply ← client.execute (LeanRedis.Command.hDel key fields).request liftM ((LeanRedis.Command.hDel key fields).decode reply)
Instances For
def
LeanRedis.Client.hExists
{τ : Type}
[Transport.Transport τ]
(client : Client τ)
(key field : String)
:
Check whether a hash field exists.
Example:
let exists ← client.hExists "user:1" "name"
Equations
- client.hExists key field = do let reply ← client.execute (LeanRedis.Command.hExists key field).request liftM ((LeanRedis.Command.hExists key field).decode reply)
Instances For
Return the number of fields in a hash.
Example:
let len ← client.hLen "user:1"
Equations
- client.hLen key = do let reply ← client.execute (LeanRedis.Command.hLen key).request liftM ((LeanRedis.Command.hLen key).decode reply)
Instances For
Return all hash field names.
Example:
let keys ← client.hKeys "user:1"
Equations
- client.hKeys key = do let reply ← client.execute (LeanRedis.Command.hKeys key).request liftM ((LeanRedis.Command.hKeys key).decode reply)
Instances For
Return all hash values.
Example:
let vals ← client.hVals "user:1"
Equations
- client.hVals key = do let reply ← client.execute (LeanRedis.Command.hVals key).request liftM ((LeanRedis.Command.hVals key).decode reply)
Instances For
def
LeanRedis.Client.hStrLen
{τ : Type}
[Transport.Transport τ]
(client : Client τ)
(key field : String)
:
Return the string length of a hash field value.
Example:
let len ← client.hStrLen "user:1" "name"
Equations
- client.hStrLen key field = do let reply ← client.execute (LeanRedis.Command.hStrLen key field).request liftM ((LeanRedis.Command.hStrLen key field).decode reply)
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
- client.hIncrBy key field amount = do let reply ← client.execute (LeanRedis.Command.hIncrBy key field amount).request liftM ((LeanRedis.Command.hIncrBy key field amount).decode reply)
Instances For
def
LeanRedis.Client.hIncrByFloat
{τ : Type}
[Transport.Transport τ]
(client : Client τ)
(key field amount : String)
:
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
def
LeanRedis.Client.hSetNx
{τ : Type}
[Transport.Transport τ]
(client : Client τ)
(key field value : String)
:
Set a hash field only if it does not exist.
Example:
let stored ← client.hSetNx "user:1" "name" "alice"
Equations
- client.hSetNx key field value = do let reply ← client.execute (LeanRedis.Command.hSetNx key field value).request liftM ((LeanRedis.Command.hSetNx key field value).decode reply)
Instances For
def
LeanRedis.Client.hRandField
{τ : Type}
[Transport.Transport τ]
(client : Client τ)
(key : String)
:
Return one random hash field.
Example:
let field ← client.hRandField "user:1"
Equations
- client.hRandField key = do let reply ← client.execute (LeanRedis.Command.hRandField key).request liftM ((LeanRedis.Command.hRandField key).decode reply)
Instances For
def
LeanRedis.Client.hRandFields
{τ : Type}
[Transport.Transport τ]
(client : Client τ)
(key : String)
(count : Int)
:
Return random hash fields.
Example:
let fields ← client.hRandFields "user:1" 2
Equations
- client.hRandFields key count = do let reply ← client.execute (LeanRedis.Command.hRandFields key count).request liftM ((LeanRedis.Command.hRandFields key count).decode reply)
Instances For
def
LeanRedis.Client.hRandFieldsWithValues
{τ : Type}
[Transport.Transport τ]
(client : Client τ)
(key : String)
(count : Int)
:
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
def
LeanRedis.Client.hScan
{τ : Type}
[Transport.Transport τ]
(client : Client τ)
(key : String)
(cursor : UInt64)
(options : HScanOptions := { })
:
Scan a hash incrementally.
Example:
let page ← client.hScan "user:1" 0
Equations
- client.hScan key cursor options = do let reply ← client.execute (LeanRedis.Command.hScan key cursor options).request liftM ((LeanRedis.Command.hScan key cursor options).decode reply)