Sign in

    valkey

    Native async Valkey/Redis client for MoonBit

    Download zip
    Author
    Version
    0.2.1
    License
    Apache-2.0
    Last updated
    4 months ago
    Downloads
    158

    Metalymph/valkey does not have a README file

    RespError

    pub suberror RespError {
    InvalidPrefix(Int)
    UnexpectedEndOfStream
    MalformedNumber
    MalformedCrlf
    } derive(ToJson,
    Debug
    )

    RespError represents errors occurring during RESP parsing.

    ValkeyError

    pub suberror ValkeyError {
    ConnectionError(String)
    ProtocolError(String)
    } derive(ToJson,
    Debug
    )

    ValkeyError represents the error types handled by the Valkey driver.

    Client

    pub struct Client {
    conn :
    Tcp

    }

    Client is a native Valkey/Redis client supporting asynchronous operations.

    Client::connect

    async fn Client::connect(host : String, port : Int) -> Client

    connect opens an asynchronous connection to the specified host and port.

    Client::del

    async fn Client::del(self : Client, key : String) -> Int64

    del removes a key and returns the number of deleted keys.

    Client::exists

    async fn Client::exists(self : Client, key : String) -> Bool

    exists returns true when the key exists.

    Client::get

    async fn Client::get(self : Client, key : String) -> String?

    get returns a string value by key, or None when the key does not exist.

    Client::ping

    async fn Client::ping(self : Client) -> Unit

    ping sends a PING command to the server and expects a PONG response.

    Client::read_response

    async fn Client::read_response(self : Client) -> RespValue

    read_response reads a RESP response from the server.

    Client::request

    async fn Client::request(self : Client, args : Array[String]) -> RespValue

    request sends a command and returns the response.

    Client::send_command

    async fn Client::send_command(self : Client, args : Array[String]) -> Unit

    send_command encodes and sends a RESP command to the server.

    Client::set

    async fn Client::set(self : Client, key : String, value : String) -> Unit

    set stores a string value by key.

    RespParser

    pub struct RespParser[R] {
    reader : R
    }

    RespParser handles decoding RESP messages from a stream.

    RespParser::new

    fn[R] RespParser::new(reader : R) -> RespParser[R]

    new creates a new RespParser from an object implementing @io.Reader.

    RespParser::parse_value

    async fn[R :
    Reader
    ] RespParser::parse_value(self : RespParser[R]) -> RespValue

    parse_value decodes a single RespValue from the reader.

    RespValue

    pub enum RespValue {
    SimpleString(String)
    Error(String)
    Integer(Int64)
    BulkString(String?)
    Array(Array[RespValue]?)
    } derive(ToJson,
    Debug
    )

    RespValue represents the different types in the RESP (Redis Serialization Protocol).

    Source Files

    Powered by MoonBit

    Site sourceReport issuePackagesBuild queueSkillsStatistics

    © 2026 mooncakes.io