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

    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::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:退出作用域、抛错或被取消时经 defer + protect_from_cancel 自动发送 UNSUBSCRIBE

    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
    } 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) -> RedisConfig

    TypedCmd

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

    }

    强类型流水线命令单元

    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 脚本摘要,零三方依赖)