ciallo-redis

    Standalone RESP2/3 Redis client with lock-free cooperative Auto-Pipelining, typed Lua scripts, Pub/Sub, and stateless SingleFlight RedisKey (zero dependency on unmbt/ciallo)

    redis
    resp
    resp3
    cache
    pipeline
    ciallo
    Download zip
    Author
    Version
    0.1.1
    License
    MIT
    Last updated
    13 hours ago
    Downloads
    12

    #unmbt/ciallo-redis

    Pure standalone RESP2/3 Redis client for MoonBit with zero dependency on unmbt/ciallo (depends only on unmbt/ciallo-data).

    #Subpackages

    • unmbt/ciallo-redis/resp (4 targets): RESP2/3 encoder and streaming incremental RespDecoder.
    • unmbt/ciallo-redis/client (3 targets): lock-free cooperative Auto-Pipelining RedisClient, named-arg commands, pipe2/pipe3 (atomic=true MULTI/EXEC), SHA-1 LuaScript[R] (EVALSHA/NOSCRIPT fallback), and cancel-safe subscribe.
    • unmbt/ciallo-redis/cache (3 targets): stateless pure-value RedisKey[K, V] delegating SingleFlight to RedisClient.

    LuaScript

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

    RedisClient

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

    RedisKey

    100% 无状态纯值 Schema-Safe 缓存键描述符:可安全在全局或局部构造;SingleFlight 托管在 RedisClient 内部按完整 Key 隔离防击穿

    RedisTransport

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

    RespDecoder

    流式增量 RESP 解码器(处理任意 TCP 拆包/粘包边界)

    RespValue

    RESP2 / RESP3 协议值 ADT(四目标纯核)

    TypedCmd

    强类型流水线命令单元

    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]

    decode_resp

    增量解码单帧 RESP2/3 值:字节不足返回 None,成功返回 Some((值, 消费字节数))

    encode_command

    fn encode_command(args : Array[Bytes]) -> Bytes

    将命令参数列表编码为标准 RESP Bulk Array(如 *2\r\n$3\r\nGET\r\n$3\r\nfoo\r\n)

    encode_value

    fn encode_value(value :
    RespValue
    ) -> Bytes

    将任意 RespValue 编码为 RESP2/3 线格式字节流(用于客户端与 Mock Server 测试)

    sha1_str_hex

    fn sha1_str_hex(input : StringView) -> String

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

    Source Files