unmbt/ciallo-redis/client does not have a README file

    HttpPostFn

    type HttpPostFn = async (String, Array[(String, String)], Bytes) -> (Int, Bytes) raise
    DataError

    Portable HTTP POST callback: (url, headers, body_bytes) -> (status_code, response_body_bytes).

    RedisTransport

    pub(open) trait RedisTransport {
    async fn send_raw(Self, payload : Bytes) -> Unit raise
    DataError

    async fn recv_resp(Self) ->
    RespValue
    raise
    DataError

    async fn close(Self) -> Unit
    }

    可插拔 RESP 传输层抽象(Native/Wasm 走 core/async/socket TCP;JS Edge 走 Upstash/HTTP;单测走 Mock)

    LuaScript

    pub struct LuaScript[R] {
    source : String
    sha1 : String
    decode : (
    RespValue
    ) -> R raise
    DataError

    }

    强类型 Lua 脚本:自动计算 SHA-1 优先走 EVALSHA,捕获 NOSCRIPT 后透明回退 EVAL

    LuaScript::LuaScript

    LuaScript::eval

    async fn[R] LuaScript::eval(self : LuaScript[R], client : RedisClient, keys? : Array[String], args? : Array[String]) -> R raise
    DataError

    RedisClient

    pub struct RedisClient {
    // private fields
    }

    高吞吐无锁协作式 Redis 客户端:内置 Auto-Pipelining 写合并与按完整 Key 隔离的 SingleFlight 回源合并

    RedisClient::close

    async fn RedisClient::close(self : RedisClient) -> Unit

    RedisClient::connect_pubsub

    基于当前客户端配置创建一条独占的 Pub/Sub 连接(自动完成 HELLO 3 / AUTH / SELECT 握手)

    RedisClient::del

    async fn RedisClient::del(self : RedisClient, keys : Array[String]) -> Int64 raise
    DataError

    RedisClient::expire

    async fn RedisClient::expire(self : RedisClient, key : StringView, seconds : Int) -> Bool raise
    DataError

    RedisClient::from_transport

    RedisClient::get

    async fn RedisClient::get(self : RedisClient, key : StringView) -> String? raise
    DataError

    RedisClient::get_bytes

    async fn RedisClient::get_bytes(self : RedisClient, key : StringView) -> Bytes? raise
    DataError

    RedisClient::hget

    async fn RedisClient::hget(self : RedisClient, key : StringView, field : StringView) -> String? raise
    DataError

    RedisClient::hset

    async fn RedisClient::hset(self : RedisClient, key : StringView, fields : Array[(String, String)]) -> Int64 raise
    DataError

    RedisClient::incr_by

    async fn RedisClient::incr_by(self : RedisClient, key : StringView, delta? : Int64) -> Int64 raise
    DataError

    RedisClient::ping

    RedisClient::pipe2

    async fn[A, B] RedisClient::pipe2(self : RedisClient, a : TypedCmd[A], b : TypedCmd[B], transactional? : Bool) -> (A, B) raise
    DataError

    RedisClient::pipe3

    async fn[A, B, C] RedisClient::pipe3(self : RedisClient, a : TypedCmd[A], b : TypedCmd[B], c : TypedCmd[C], transactional? : Bool) -> (A, B, C) raise
    DataError

    RedisClient::publish

    async fn RedisClient::publish(self : RedisClient, channel : StringView, message : Bytes) -> Int64 raise
    DataError

    RedisClient::send_command

    发送任意原始 RESP 命令并返回解码后的 RespValue

    RedisClient::set

    async fn RedisClient::set(self : RedisClient, key : StringView, value : StringView, ex? : Int, px? : Int64, nx? : Bool, xx? : Bool, keep_ttl? : Bool, get_prev? : Bool) -> String? raise
    DataError

    RedisClient::single_flight

    async fn RedisClient::single_flight(self : RedisClient, full_key : StringView, loader : async () -> String) -> String

    RedisClient::subscribe

    async fn RedisClient::subscribe(self : RedisClient, channels : Array[String], on_message : async (String, Bytes) -> Unit) -> Unit

    结构化并发 Pub/Sub(兼容入口;生产多路并发命令场景请使用 connect_pubsub() 独占连接)

    RedisClient::zadd

    async fn RedisClient::zadd(self : RedisClient, key : StringView, members : Array[(Double, String)], nx? : Bool, xx? : Bool, gt? : Bool, lt? : Bool) -> Int64 raise
    DataError

    RedisConfig

    pub(all) struct RedisConfig {
    host : String
    port : Int
    password : String?
    db : Int
    protocol_version : Int
    auto_pipeline : Bool
    connect_timeout_ms : Int
    tls : Bool
    } derive(Eq,
    Debug
    )

    RedisConfig::RedisConfig

    fn RedisConfig::RedisConfig(host? : String, port? : Int, password? : String, db? : Int, protocol_version? : Int, auto_pipeline? : Bool, connect_timeout_ms? : Int, tls? : Bool) -> RedisConfig

    RedisPubSub

    pub struct RedisPubSub {
    // private fields
    }

    独占连接 Pub/Sub 会话(与命令 Auto-Pipelining 通道物理隔离,严禁与普通 GET/SET 争抢同一 TCP 流)

    RedisPubSub::close

    async fn RedisPubSub::close(self : RedisPubSub) -> Unit

    RedisPubSub::from_transport

    fn RedisPubSub::from_transport(transport : &RedisTransport) -> RedisPubSub

    RedisPubSub::subscribe

    async fn RedisPubSub::subscribe(self : RedisPubSub, channels : Array[String], on_message : async (String, Bytes) -> Unit) -> Unit

    结构化并发 Pub/Sub:严格追踪活跃订阅计数 subscribed_count,退订时消费完所有确认帧至归零

    RedisPubSub::subscribed_count

    fn RedisPubSub::subscribed_count(self : RedisPubSub) -> Int

    TypedCmd

    pub struct TypedCmd[R] {
    args : Array[Bytes]
    decode : (
    RespValue
    ) -> R raise
    DataError

    }

    强类型流水线命令单元

    UpstashHttpTransport

    pub struct UpstashHttpTransport {
    // private fields
    }

    Upstash REST /pipeline implementation of RedisTransport.

    UpstashHttpTransport::UpstashHttpTransport

    fn UpstashHttpTransport::UpstashHttpTransport(url~ : String, token~ : String, post~ : async (String, Array[(String, String)], Bytes) -> (Int, Bytes) raise
    DataError
    ) -> UpstashHttpTransport

    cmd_del

    fn cmd_del(key : StringView) -> TypedCmd[Int64]

    cmd_get

    fn cmd_get(key : StringView) -> TypedCmd[String?]

    cmd_incr

    fn cmd_incr(key : StringView) -> TypedCmd[Int64]

    cmd_set

    fn cmd_set(key : StringView, value : StringView, ex? : Int, nx? : Bool) -> TypedCmd[Bool]

    sha1_str_hex

    fn sha1_str_hex(input : StringView) -> String

    纯 MoonBit FIPS 180-4 SHA-1(专用于 Redis EVALSHA 脚本摘要,零三方依赖)