Get the value of a string key.
Example:
let value ← client.get "key"
Equations
- client.get key = do let reply ← client.execute (LeanRedis.Command.get key).request liftM ((LeanRedis.Command.get key).decode reply)
Instances For
Set a string key with optional SET modifiers.
Example:
let stored ← client.set "key" "value"
let storedNx ← client.set "key" "value" { condition? := some .nx }
Equations
- client.set key value options = do let reply ← client.execute (LeanRedis.Command.set key value options).request liftM ((LeanRedis.Command.set key value options).decode reply)
Instances For
Get multiple string keys with nullable results.
Example:
let values ← client.mGet #["a", "b"]
Equations
- client.mGet keys = do let reply ← client.execute (LeanRedis.Command.mGet keys).request liftM ((LeanRedis.Command.mGet keys).decode reply)
Instances For
Set multiple string entries with MSET.
Example:
let _ ← client.mSet #[("a", "1"), ("b", "2")]
Equations
- client.mSet entries = do let reply ← client.execute (LeanRedis.Command.mSet entries).request liftM ((LeanRedis.Command.mSet entries).decode reply)
Instances For
Set multiple string entries only if all keys are absent.
Example:
let stored ← client.mSetNx #[("a", "1"), ("b", "2")]
Equations
- client.mSetNx entries = do let reply ← client.execute (LeanRedis.Command.mSetNx entries).request liftM ((LeanRedis.Command.mSetNx entries).decode reply)
Instances For
Get and delete a string key.
Example:
let previous ← client.getDel "key"
Equations
- client.getDel key = do let reply ← client.execute (LeanRedis.Command.getDel key).request liftM ((LeanRedis.Command.getDel key).decode reply)
Instances For
Get a string key and optionally update its expiration.
Example:
let value ← client.getEx "key" (some <| .persist)
Equations
- client.getEx key mode? = do let reply ← client.execute (LeanRedis.Command.getEx key mode?).request liftM ((LeanRedis.Command.getEx key mode?).decode reply)
Instances For
Read a substring from a string value.
Example:
let part ← client.getRange "key" 0 4
Equations
- client.getRange key start stop = do let reply ← client.execute (LeanRedis.Command.getRange key start stop).request liftM ((LeanRedis.Command.getRange key start stop).decode reply)
Instances For
Replace a string value and return the previous one.
Example:
let previous ← client.getSet "key" "next"
Equations
- client.getSet key value = do let reply ← client.execute (LeanRedis.Command.getSet key value).request liftM ((LeanRedis.Command.getSet key value).decode reply)
Instances For
Overwrite part of a string starting at the given offset.
Example:
let size ← client.setRange "key" 2 "xy"
Equations
- client.setRange key offset value = do let reply ← client.execute (LeanRedis.Command.setRange key offset value).request liftM ((LeanRedis.Command.setRange key offset value).decode reply)
Instances For
Return the length of a string value.
Example:
let len ← client.strLen "key"
Equations
- client.strLen key = do let reply ← client.execute (LeanRedis.Command.strLen key).request liftM ((LeanRedis.Command.strLen key).decode reply)
Instances For
Append text to a string value.
Example:
let len ← client.append "key" "suffix"
Equations
- client.append key value = do let reply ← client.execute (LeanRedis.Command.append key value).request liftM ((LeanRedis.Command.append key value).decode reply)
Instances For
Increment a string integer value by one.
Example:
let value ← client.incr "counter"
Equations
- client.incr key = do let reply ← client.execute (LeanRedis.Command.incr key).request liftM ((LeanRedis.Command.incr key).decode reply)
Instances For
Increment a string integer value by the given amount.
Example:
let value ← client.incrBy "counter" 5
Equations
- client.incrBy key amount = do let reply ← client.execute (LeanRedis.Command.incrBy key amount).request liftM ((LeanRedis.Command.incrBy key amount).decode reply)
Instances For
Increment a string numeric value by a decimal amount.
Example:
let value ← client.incrByFloat "score" "1.5"
Equations
- client.incrByFloat key amount = do let reply ← client.execute (LeanRedis.Command.incrByFloat key amount).request liftM ((LeanRedis.Command.incrByFloat key amount).decode reply)
Instances For
Decrement a string integer value by one.
Example:
let value ← client.decr "counter"
Equations
- client.decr key = do let reply ← client.execute (LeanRedis.Command.decr key).request liftM ((LeanRedis.Command.decr key).decode reply)
Instances For
Decrement a string integer value by the given amount.
Example:
let value ← client.decrBy "counter" 3
Equations
- client.decrBy key amount = do let reply ← client.execute (LeanRedis.Command.decrBy key amount).request liftM ((LeanRedis.Command.decrBy key amount).decode reply)
Instances For
Set a string value only if the key does not exist.
Example:
let stored ← client.setNx "key" "value"
Equations
- client.setNx key value = do let reply ← client.execute (LeanRedis.Command.setNx key value).request liftM ((LeanRedis.Command.setNx key value).decode reply)
Instances For
Set a string value with a TTL in seconds.
Example:
let _ ← client.setEx "key" 30 "value"
Equations
- client.setEx key seconds value = do let reply ← client.execute (LeanRedis.Command.setEx key seconds value).request liftM ((LeanRedis.Command.setEx key seconds value).decode reply)
Instances For
Set a string value with a TTL in milliseconds.
Example:
let _ ← client.pSetEx "key" 500 "value"
Equations
- One or more equations did not get rendered due to their size.