redis

    A modern, high performance Redis client for MoonBit.

    redis
    client
    valkey
    Download zip
    Author
    Version
    0.2.4
    License
    Apache-2.0
    Last updated
    22 hours ago
    Downloads
    268

    #oboard/redis

    moonbit-redis is a modern, high performance Redis client for MoonBit.

    #Usage

    #Basic Example

    ///|
    async test "string_set_get" {
    @async.with_task_group(async fn(_root) {
    let client = connect("localhost", 6379)
    defer client.close()

    // SET
    let set_result = client.set("test:string", "hello_world")
    assert_true(set_result is Ok("OK"))

    // GET
    let get_result = client.get("test:string")
    assert_true(get_result is Ok("hello_world"))

    // Cleanup
    let _ = client.del(["test:string"])
    })
    }

    #Ping

    ///|
    async test "ping" {
    @async.with_task_group(async fn(_root) {
    let client = @redis.Client("localhost", port=6379)
    defer client.close()
    let pong = client.ping()
    assert_true(pong is Ok("PONG"))
    })
    }

    #Authentication and Database Selection

    connect accepts optional password?, username? (Redis 6+ ACL) and db? arguments. AUTH and SELECT are sent automatically after the connection is established; failures raise ConnectError and close the connection.
    ///|
    async test "connect_with_auth" {
    @async.with_task_group(async fn(_root) {
    let client = @redis.Client(
    "localhost",
    port=6379,
    username="default",
    password="secret",
    db=1,
    )
    defer client.close()
    let pong = client.ping()
    assert_true(pong is Ok("PONG"))
    })
    }

    RedisArray

    type RedisArray = Result[Array[String], String]

    The result of an operation that can fail: either Ok(value) or Err(error).

    RedisBool

    type RedisBool = Result[Bool, String]

    The result of an operation that can fail: either Ok(value) or Err(error).

    RedisBulkString

    type RedisBulkString = Result[String?, String]

    The result of an operation that can fail: either Ok(value) or Err(error).

    RedisHash

    type RedisHash = Result[Map[String, String], String]

    The result of an operation that can fail: either Ok(value) or Err(error).

    RedisInt

    type RedisInt = Result[Int, String]

    The result of an operation that can fail: either Ok(value) or Err(error).

    RedisJson

    type RedisJson = Result[
    Json
    , String]

    The result of an operation that can fail: either Ok(value) or Err(error).

    RedisResult

    type RedisResult[T] = Result[T, String]

    Redis命令的结果类型

    RedisStreamMessageArray

    type RedisStreamMessageArray = Result[Array[RedisStreamMessage], String]

    The result of an operation that can fail: either Ok(value) or Err(error).

    RedisStreamResult

    type RedisStreamResult = Result[RedisStream, String]

    The result of an operation that can fail: either Ok(value) or Err(error).

    RedisString

    type RedisString = Result[String, String]

    常用的具体返回类型

    ConnectError

    pub(all) suberror ConnectError {
    AuthFailed(String)
    SelectFailed(String)
    }

    连接建立过程中的错误

    Bit

    pub(all) enum Bit {
    Zero
    One
    }

    impl Show for Bit

    Bit::output

    fn Bit::output(self : Bit, logger : &Logger) -> Unit

    Bit::to_string

    fn Bit::to_string(self : Bit) -> String

    BitFieldEncoding

    pub(all) enum BitFieldEncoding {
    U8
    U16
    U32
    U64
    I8
    I16
    I32
    I64
    }

    BitFieldEncoding::output

    fn BitFieldEncoding::output(self : BitFieldEncoding, logger : &Logger) -> Unit

    BitFieldEncoding::to_string

    fn BitFieldEncoding::to_string(self : BitFieldEncoding) -> String

    BitFieldOperation

    pub(all) enum BitFieldOperation {
    Get(encoding~ : BitFieldEncoding, offset~ : Int)
    Set(encoding~ : BitFieldEncoding, offset~ : Int, value~ : Bit)
    Incrby(encoding~ : BitFieldEncoding, offset~ : Int, value~ : Int)
    Overflow(behavior~ : String)
    }

    BitFieldOperation::to_array

    fn BitFieldOperation::to_array(self : BitFieldOperation) -> Array[String]

    Client

    pub struct Client {
    conn :
    Tcp

    }

    Client::Client

    async fn Client::Client(host : StringView, port? : Int, protocol? :
    IpProtocolPreference
    , username? : String, password? : String, db? : Int) -> Client

    建立到 Redis 服务器的连接。

    连接建立后可选地自动完成认证和选库:
    • password?:提供时自动发送 AUTH; 同时提供 username? 时使用 Redis 6+ ACL 形式 AUTH <username> <password>。 单独提供 username? 而不提供 password? 时不发送 AUTH(Redis 没有仅用户名的认证)。
    • db?:提供时自动发送 SELECT <db> 切换到指定数据库。

    认证或选库失败时会关闭连接并抛出 ConnectError。

    Client::append

    async fn Client::append(self : Client, key : String, value : String) -> Result[Int, String]

    Client::auth

    async fn Client::auth(self : Client, password : String) -> Result[String, String]

    Client::auth_username

    async fn Client::auth_username(self : Client, username : String, password : String) -> Result[String, String]

    Client::bgrewriteaof

    async fn Client::bgrewriteaof(self : Client) -> RedisValue

    Client::bgsave

    async fn Client::bgsave(self : Client) -> RedisValue

    Client::bitcount

    async fn Client::bitcount(self : Client, key : String) -> Result[Int, String]

    Client::bitcount_range

    async fn Client::bitcount_range(self : Client, key : String, start : Int, end : Int) -> Result[Int, String]

    Client::bitfield

    async fn Client::bitfield(self : Client, key : String, operations : Array[BitFieldOperation]) -> Result[Array[String], String]

    Client::bitfield_ro

    async fn Client::bitfield_ro(self : Client, key : String, operations : Array[String]) -> Result[Array[String], String]

    Client::bitop

    async fn Client::bitop(self : Client, operation : String, destkey : String, keys : Array[String]) -> Result[Int, String]

    Client::bitpos

    async fn Client::bitpos(self : Client, key : String, bit : Bit) -> Result[Int, String]

    Client::bitpos_range

    async fn Client::bitpos_range(self : Client, key : String, bit : Bit, start : Int, end : Int) -> Result[Int, String]

    Client::blmove

    async fn Client::blmove(self : Client, source : String, destination : String, wherefrom~ : Int, whereto~ : Int, timeout~ : Int) -> RedisValue

    Client::blmpop

    async fn Client::blmpop(self : Client, timeout~ : Int, numkeys : String, keys : Array[String], where_~ : String) -> RedisValue

    Client::blpop

    async fn Client::blpop(self : Client, keys : Array[String], timeout~ : Int) -> RedisValue

    Client::brpop

    async fn Client::brpop(self : Client, keys : Array[String], timeout~ : Int) -> RedisValue

    Client::brpoplpush

    async fn Client::brpoplpush(self : Client, source : String, destination : String, timeout~ : Int) -> RedisValue

    Client::bzmpop

    async fn Client::bzmpop(self : Client, timeout : String, numkeys : String, keys : Array[String], where_ : String, count : String?) -> Result[Array[String], String]

    Client::bzpopmax

    async fn Client::bzpopmax(self : Client, keys : Array[String], timeout : String) -> Result[String, String]

    Client::bzpopmin

    async fn Client::bzpopmin(self : Client, keys : Array[String], timeout : String) -> Result[String, String]

    Client::client_caching

    async fn Client::client_caching(self : Client, mode : String) -> Result[String, String]

    Client::client_getname

    async fn Client::client_getname(self : Client) -> Result[String?, String]

    Client::client_getredir

    async fn Client::client_getredir(self : Client) -> Result[Int, String]

    Client::client_id

    async fn Client::client_id(self : Client) -> Result[Int, String]

    Client::client_info

    async fn Client::client_info(self : Client) -> Result[String, String]

    Client::client_kill

    async fn Client::client_kill(self : Client, ip_port : String) -> Result[Int, String]

    Client::client_list

    async fn Client::client_list(self : Client) -> Result[String, String]

    Client::client_no_evict

    async fn Client::client_no_evict(self : Client, mode : String) -> Result[String, String]

    Client::client_no_touch

    async fn Client::client_no_touch(self : Client, mode : String) -> Result[String, String]

    Client::client_pause

    async fn Client::client_pause(self : Client, timeout : String) -> Result[String, String]

    Client::client_reply

    async fn Client::client_reply(self : Client, mode : String) -> Result[String, String]

    Client::client_setname

    async fn Client::client_setname(self : Client, connection_name : String) -> Result[String, String]

    Client::client_tracking

    async fn Client::client_tracking(self : Client, mode : String) -> Result[String, String]

    Client::client_trackinginfo

    async fn Client::client_trackinginfo(self : Client) -> Result[Array[String], String]

    Client::client_unblock

    async fn Client::client_unblock(self : Client, client_id : String) -> Result[Int, String]

    Client::client_unpause

    async fn Client::client_unpause(self : Client) -> Result[String, String]

    Client::close

    fn Client::close(self : Client) -> Unit

    Client::cluster_addslots

    async fn Client::cluster_addslots(self : Client, slots : Array[Int]) -> Result[String, String]

    Client::cluster_addslotsrange

    async fn Client::cluster_addslotsrange(self : Client, ranges : Array[(Int, Int)]) -> Result[String, String]

    Client::cluster_bumpepoch

    async fn Client::cluster_bumpepoch(self : Client) -> Result[String, String]

    Client::cluster_count_failure_reports

    async fn Client::cluster_count_failure_reports(self : Client, node_id : String) -> Result[Int, String]

    Client::cluster_countkeysinslot

    async fn Client::cluster_countkeysinslot(self : Client, slot : Int) -> Result[Int, String]

    Client::cluster_delslots

    async fn Client::cluster_delslots(self : Client, slots : Array[Int]) -> Result[String, String]

    Client::cluster_delslotsrange

    async fn Client::cluster_delslotsrange(self : Client, ranges : Array[(Int, Int)]) -> Result[String, String]

    Client::cluster_failover

    async fn Client::cluster_failover(self : Client, option? : String) -> Result[String, String]

    Client::cluster_flushslots

    async fn Client::cluster_flushslots(self : Client) -> Result[String, String]

    Client::cluster_forget

    async fn Client::cluster_forget(self : Client, node_id : String) -> Result[String, String]

    Client::cluster_getkeysinslot

    async fn Client::cluster_getkeysinslot(self : Client, slot : Int, count : Int) -> Result[Array[String], String]

    Client::cluster_info

    async fn Client::cluster_info(self : Client) -> Result[String, String]

    Client::cluster_keyslot

    async fn Client::cluster_keyslot(self : Client, key : String) -> Result[Int, String]

    async fn Client::cluster_links(self : Client) -> Result[Array[String], String]

    Client::cluster_meet

    async fn Client::cluster_meet(self : Client, ip : String, port : Int, cluster_bus_port? : Int) -> Result[String, String]

    Client::cluster_myid

    async fn Client::cluster_myid(self : Client) -> Result[String, String]

    Client::cluster_myshardid

    async fn Client::cluster_myshardid(self : Client) -> Result[String, String]

    Client::cluster_nodes

    async fn Client::cluster_nodes(self : Client) -> Result[String, String]

    Client::cluster_replicas

    async fn Client::cluster_replicas(self : Client, node_id : String) -> Result[Array[String], String]

    Client::cluster_replicate

    async fn Client::cluster_replicate(self : Client, node_id : String) -> Result[String, String]

    Client::cluster_reset

    async fn Client::cluster_reset(self : Client, reset_type? : String) -> Result[String, String]

    Client::cluster_saveconfig

    async fn Client::cluster_saveconfig(self : Client) -> Result[String, String]

    Client::cluster_set_config_epoch

    async fn Client::cluster_set_config_epoch(self : Client, config_epoch : Int) -> Result[String, String]

    Client::cluster_setslot

    async fn Client::cluster_setslot(self : Client, slot : Int, subcommand : String, node_id? : String) -> Result[String, String]

    Client::cluster_shards

    async fn Client::cluster_shards(self : Client) -> Result[Array[String], String]

    Client::cluster_slaves

    async fn Client::cluster_slaves(self : Client, node_id : String) -> Result[Array[String], String]

    Client::cluster_slot_stats

    async fn Client::cluster_slot_stats(self : Client, slots : Array[Int]) -> Result[Array[String], String]

    Client::cluster_slots

    async fn Client::cluster_slots(self : Client) -> Result[Array[String], String]

    Client::command

    async fn Client::command(self : Client) -> RedisValue

    Client::command_count

    async fn Client::command_count(self : Client) -> RedisValue

    Client::command_docs

    async fn Client::command_docs(self : Client, command_names : Array[String]) -> RedisValue

    Client::command_getkeys

    async fn Client::command_getkeys(self : Client, command : Array[String]) -> RedisValue

    Client::command_getkeysandflags

    async fn Client::command_getkeysandflags(self : Client, command : Array[String]) -> RedisValue

    Client::command_info

    async fn Client::command_info(self : Client, command_names : Array[String]) -> RedisValue

    Client::command_list

    async fn Client::command_list(self : Client) -> RedisValue

    Client::config_get

    async fn Client::config_get(self : Client, parameter : String) -> RedisValue

    Client::config_resetstat

    async fn Client::config_resetstat(self : Client) -> RedisValue

    Client::config_rewrite

    async fn Client::config_rewrite(self : Client) -> RedisValue

    Client::config_set

    async fn Client::config_set(self : Client, parameter : String, value : String) -> RedisValue

    Client::copy

    async fn Client::copy(self : Client, source : String, destination : String) -> Result[Int, String]

    Client::dbsize

    async fn Client::dbsize(self : Client) -> Result[Int, String]

    Client::debug_object

    async fn Client::debug_object(self : Client, key : String) -> RedisValue

    Client::debug_segfault

    async fn Client::debug_segfault(self : Client) -> RedisValue

    Client::decr

    async fn Client::decr(self : Client, key : String) -> Result[Int, String]

    Client::decrby

    async fn Client::decrby(self : Client, key : String, decrement : String) -> Result[Int, String]

    Client::del

    async fn Client::del(self : Client, keys : Array[String]) -> Result[Int, String]

    Client::dump

    async fn Client::dump(self : Client, key : String) -> Result[String?, String]

    Client::echo

    async fn Client::echo(self : Client, message : String) -> Result[String, String]

    Client::exists

    async fn Client::exists(self : Client, keys : Array[String]) -> Result[Int, String]

    Client::expire

    async fn Client::expire(self : Client, key : String, seconds : String) -> Result[Int, String]

    Client::expireat

    async fn Client::expireat(self : Client, key : String, timestamp : String) -> Result[Int, String]

    Client::expiretime

    async fn Client::expiretime(self : Client, key : String) -> Result[Int, String]

    Client::flushall

    async fn Client::flushall(self : Client) -> Result[String, String]

    Client::flushdb

    async fn Client::flushdb(self : Client) -> Result[String, String]

    Client::geoadd

    async fn Client::geoadd(self : Client, key : String, longitude : String, latitude : String, value : String) -> Result[Int, String]

    Client::geoadd_multiple

    async fn Client::geoadd_multiple(self : Client, key : String, coordinates : Array[GeoCoordinates]) -> Result[Int, String]

    Client::geodist

    async fn Client::geodist(self : Client, key : String, member1 : String, member2 : String) -> Result[String?, String]

    Client::geodist_unit

    async fn Client::geodist_unit(self : Client, key : String, member1 : String, member2 : String, unit : GeoUnits) -> Result[String?, String]

    Client::geohash

    async fn Client::geohash(self : Client, key : String, members : Array[String]) -> Result[Array[String], String]

    Client::geopos

    async fn Client::geopos(self : Client, key : String, members : Array[String]) -> Result[Array[String], String]

    Client::georadius

    async fn Client::georadius(self : Client, key : String, longitude : String, latitude : String, radius : String, unit : GeoUnits) -> Result[Array[String], String]

    Client::georadius_ro

    async fn Client::georadius_ro(self : Client, key : String, longitude : String, latitude : String, radius : String, unit : GeoUnits) -> Result[Array[String], String]

    Client::georadiusbymember

    async fn Client::georadiusbymember(self : Client, key : String, value : String, radius : String, unit : GeoUnits) -> Result[Array[String], String]

    Client::georadiusbymember_ro

    async fn Client::georadiusbymember_ro(self : Client, key : String, value : String, radius : String, unit : GeoUnits) -> Result[Array[String], String]

    Client::geosearch

    async fn Client::geosearch(self : Client, key : String, member_ : String, radius : String, unit : GeoUnits) -> Result[Array[String], String]

    Client::geosearch_box

    async fn Client::geosearch_box(self : Client, key : String, coordinates : GeoCoordinates, search_box : GeoSearchByBox) -> Result[Array[String], String]

    Client::geosearch_with_dist

    async fn Client::geosearch_with_dist(self : Client, key : String, member_ : String, radius : Double, unit : GeoUnits) -> Result[Array[String], String]

    Client::geosearchstore

    async fn Client::geosearchstore(self : Client, source : String, destination : String, member_ : String, radius : String, unit : GeoUnits) -> Result[Int, String]

    Client::geosearchstore_box

    async fn Client::geosearchstore_box(self : Client, destination : String, source : String, from_member : String, search_box : GeoSearchByBox) -> Result[Int, String]

    Client::geosearchstore_with_dist

    async fn Client::geosearchstore_with_dist(self : Client, destination : String, source : String, member_ : String, radius : Double, unit : GeoUnits) -> Result[Int, String]

    Client::get

    async fn Client::get(self : Client, key : String) -> Result[String, String]

    Client::getbit

    async fn Client::getbit(self : Client, key : String, offset : Int) -> Result[Int, String]

    Client::getdel

    async fn Client::getdel(self : Client, key : String) -> Result[String, String]

    Client::getex

    async fn Client::getex(self : Client, key : String, ex : String) -> Result[String, String]

    Client::getrange

    async fn Client::getrange(self : Client, key : String, start : String, end : String) -> Result[String, String]

    Client::getset

    async fn Client::getset(self : Client, key : String, value : String) -> Result[String, String]

    Client::hdel

    async fn Client::hdel(self : Client, key : String, fields : Array[String]) -> Result[Int, String]

    Client::hello

    async fn Client::hello(self : Client, protover : String) -> Result[Array[String], String]

    Client::hexists

    async fn Client::hexists(self : Client, key : String, field : String) -> Result[Bool, String]

    Client::hget

    async fn Client::hget(self : Client, key : String, field : String) -> Result[String, String]

    Client::hgetall

    async fn Client::hgetall(self : Client, key : String) -> Result[Map[String, String], String]

    Client::hkeys

    async fn Client::hkeys(self : Client, key : String) -> Result[Array[String], String]

    Client::hlen

    async fn Client::hlen(self : Client, key : String) -> Result[Int, String]

    Client::hset

    async fn Client::hset(self : Client, key : String, field : String, value : String) -> Result[Int, String]

    Client::hvals

    async fn Client::hvals(self : Client, key : String) -> Result[Array[String], String]

    Client::incr

    async fn Client::incr(self : Client, key : String) -> Result[Int, String]

    Client::incrby

    async fn Client::incrby(self : Client, key : String, increment : String) -> Result[Int, String]

    Client::incrbyfloat

    async fn Client::incrbyfloat(self : Client, key : String, increment : String) -> Result[String, String]

    Client::info

    async fn Client::info(self : Client) -> RedisValue

    Client::info_section

    async fn Client::info_section(self : Client, section : String) -> RedisValue

    Client::json_arrappend

    async fn Client::json_arrappend(self : Client, key : String, path : String, values : Array[String]) -> Result[Int, String]

    JSON.ARRAPPEND - 向JSON数组追加元素

    Client::json_arrinsert

    async fn Client::json_arrinsert(self : Client, key : String, path : String, index : Int, values : Array[String]) -> Result[Int, String]

    JSON.ARRINSERT - 在JSON数组指定位置插入元素

    Client::json_arrlen

    async fn Client::json_arrlen(self : Client, key : String, path : String) -> Result[Int, String]

    JSON.ARRLEN - 获取JSON数组长度

    Client::json_arrpop

    async fn Client::json_arrpop(self : Client, key : String, path : String, index : Int) -> Result[String, String]

    JSON.ARRPOP - 从JSON数组弹出元素

    Client::json_arrtrim

    async fn Client::json_arrtrim(self : Client, key : String, path : String, start : Int, stop : Int) -> Result[Int, String]

    JSON.ARRTRIM - 修剪JSON数组

    Client::json_clear

    async fn Client::json_clear(self : Client, key : String, path : String) -> Result[Int, String]

    JSON.CLEAR - 清空JSON值

    Client::json_debug

    async fn Client::json_debug(self : Client, subcommand : String, key : String, path : String) -> Result[String, String]

    JSON.DEBUG - JSON调试命令

    Client::json_del

    async fn Client::json_del(self : Client, key : String, path : String) -> Result[Int, String]

    JSON.DEL - 删除JSON路径

    Client::json_forget

    async fn Client::json_forget(self : Client, key : String, path : String) -> Result[Int, String]

    JSON.FORGET - 删除JSON路径(JSON.DEL的别名)

    Client::json_get

    async fn Client::json_get(self : Client, key : String, path : String) -> Result[
    Json
    , String]

    JSON.GET - 获取JSON值

    Client::json_numincrby

    async fn Client::json_numincrby(self : Client, key : String, path : String, value : String) -> Result[String, String]

    JSON.NUMINCRBY - 对JSON数值进行增量操作

    Client::json_nummultby

    async fn Client::json_nummultby(self : Client, key : String, path : String, value : String) -> Result[String, String]

    JSON.NUMMULTBY - 对JSON数值进行乘法操作

    Client::json_objkeys

    async fn Client::json_objkeys(self : Client, key : String, path : String) -> Result[Array[String], String]

    JSON.OBJKEYS - 获取JSON对象的键

    Client::json_objlen

    async fn Client::json_objlen(self : Client, key : String, path : String) -> Result[Int, String]

    JSON.OBJLEN - 获取JSON对象的键数量

    Client::json_resp

    async fn Client::json_resp(self : Client, key : String, path : String) -> Result[Array[String], String]

    JSON.RESP - 以RESP格式返回JSON值

    Client::json_set

    async fn Client::json_set(self : Client, key : String, path : String, value : String) -> Result[
    Json
    , String]

    JSON.SET - 设置JSON值

    Client::json_strappend

    async fn Client::json_strappend(self : Client, key : String, path : String, value : String) -> Result[Int, String]

    JSON.STRAPPEND - 向JSON字符串追加内容

    Client::json_strlen

    async fn Client::json_strlen(self : Client, key : String, path : String) -> Result[Int, String]

    JSON.STRLEN - 获取JSON字符串长度

    Client::json_toggle

    async fn Client::json_toggle(self : Client, key : String, path : String) -> Result[Int, String]

    JSON.TOGGLE - 切换JSON布尔值

    Client::json_type

    async fn Client::json_type(self : Client, key : String, path : String) -> Result[String, String]

    JSON.TYPE - 获取JSON值类型

    Client::keys

    async fn Client::keys(self : Client, pattern : String) -> Result[Array[String], String]

    Client::lastsave

    async fn Client::lastsave(self : Client) -> RedisValue

    Client::latency_doctor

    async fn Client::latency_doctor(self : Client) -> RedisValue

    Client::latency_graph

    async fn Client::latency_graph(self : Client, event : String) -> RedisValue

    Client::latency_history

    async fn Client::latency_history(self : Client, event : String) -> RedisValue

    Client::latency_latest

    async fn Client::latency_latest(self : Client) -> RedisValue

    Client::latency_reset

    async fn Client::latency_reset(self : Client, events : Array[String]) -> RedisValue

    Client::lindex

    async fn Client::lindex(self : Client, key : String, index~ : Int) -> Result[String, String]

    Client::linsert

    async fn Client::linsert(self : Client, key : String, where_~ : String, pivot~ : String, element~ : String) -> Result[Int, String]

    Client::llen

    async fn Client::llen(self : Client, key : String) -> Result[Int, String]

    Client::lmove

    async fn Client::lmove(self : Client, source : String, destination : String, wherefrom~ : Int, whereto~ : Int) -> RedisValue

    Client::lmpop

    async fn Client::lmpop(self : Client, numkeys : String, keys : Array[String], where_~ : String) -> RedisValue

    Client::lpop

    async fn Client::lpop(self : Client, key : String) -> Result[String, String]

    Client::lpos

    async fn Client::lpos(self : Client, key : String, element~ : String) -> RedisValue

    Client::lpush

    async fn Client::lpush(self : Client, key : String, values : Array[String]) -> Result[Int, String]

    Client::lpushx

    async fn Client::lpushx(self : Client, key : String, values : Array[String]) -> Result[Int, String]

    Client::lrange

    async fn Client::lrange(self : Client, key : String, start~ : Int, stop~ : Int) -> Result[Array[String], String]

    Client::lrem

    async fn Client::lrem(self : Client, key : String, count~ : Int, value~ : String) -> Result[Int, String]

    Client::lset

    async fn Client::lset(self : Client, key : String, index~ : Int, value~ : String) -> Result[String, String]

    Client::ltrim

    async fn Client::ltrim(self : Client, key : String, start~ : Int, stop~ : Int) -> Result[String, String]

    Client::memory_doctor

    async fn Client::memory_doctor(self : Client) -> RedisValue

    Client::memory_malloc_stats

    async fn Client::memory_malloc_stats(self : Client) -> RedisValue

    Client::memory_purge

    async fn Client::memory_purge(self : Client) -> RedisValue

    Client::memory_stats

    async fn Client::memory_stats(self : Client) -> RedisValue

    Client::memory_usage

    async fn Client::memory_usage(self : Client, key : String) -> RedisValue

    Client::mget

    async fn Client::mget(self : Client, keys : Array[String]) -> Result[Array[String], String]

    Client::migrate

    async fn Client::migrate(self : Client, host : String, port : String, key : String, destination_db : String, timeout : String) -> Result[String, String]

    Client::module_list

    async fn Client::module_list(self : Client) -> RedisValue

    Client::module_load

    async fn Client::module_load(self : Client, path : String) -> RedisValue

    Client::module_loadex

    async fn Client::module_loadex(self : Client, path : String, args : Array[String]) -> RedisValue

    Client::module_unload

    async fn Client::module_unload(self : Client, name : String) -> RedisValue

    Client::monitor

    async fn Client::monitor(self : Client) -> RedisValue

    Client::move_

    async fn Client::move_(self : Client, key : String, db : String) -> Result[Int, String]

    Client::mset

    async fn Client::mset(self : Client, key_values : Map[String, String]) -> Result[String, String]

    Client::msetnx

    async fn Client::msetnx(self : Client, key_values : Map[String, String]) -> Result[Int, String]

    Client::object_encoding

    async fn Client::object_encoding(self : Client, key : String) -> Result[String?, String]

    Client::object_freq

    async fn Client::object_freq(self : Client, key : String) -> Result[Int, String]

    Client::object_idletime

    async fn Client::object_idletime(self : Client, key : String) -> Result[Int, String]

    Client::object_refcount

    async fn Client::object_refcount(self : Client, key : String) -> Result[Int, String]

    Client::persist

    async fn Client::persist(self : Client, key : String) -> Result[Int, String]

    Client::pexpire

    async fn Client::pexpire(self : Client, key : String, milliseconds : String) -> Result[Int, String]

    Client::pexpireat

    async fn Client::pexpireat(self : Client, key : String, timestamp : String) -> Result[Int, String]

    Client::pexpiretime

    async fn Client::pexpiretime(self : Client, key : String) -> Result[Int, String]

    Client::ping

    async fn Client::ping(self : Client) -> Result[String, String]

    Client::psetex

    async fn Client::psetex(self : Client, key : String, milliseconds : String, value : String) -> Result[String, String]

    Client::psubscribe

    async fn Client::psubscribe(self : Client, patterns : Array[String]) -> Result[Array[String], String]

    订阅一个或多个模式 返回模式订阅确认信息数组

    Client::psync

    async fn Client::psync(self : Client, replicationid : String, offset : String) -> RedisValue

    Client::pttl

    async fn Client::pttl(self : Client, key : String) -> Result[Int, String]

    Client::publish

    async fn Client::publish(self : Client, channel : String, message : String) -> Result[Int, String]

    发布消息到指定频道 返回接收到消息的订阅者数量

    Client::pubsub_channels

    async fn Client::pubsub_channels(self : Client, pattern? : String) -> Result[Array[String], String]

    查看订阅与发布系统状态 PUBSUB CHANNELS [pattern] - 列出当前活跃频道

    Client::pubsub_numpat

    async fn Client::pubsub_numpat(self : Client) -> Result[Int, String]

    查看订阅与发布系统状态 PUBSUB NUMPAT - 返回模式订阅数量

    Client::pubsub_numsub

    async fn Client::pubsub_numsub(self : Client, channels? : Array[String]) -> Result[Array[String], String]

    查看订阅与发布系统状态 PUBSUB NUMSUB [channel [channel ...]] - 返回频道订阅者数量

    Client::pubsub_shardchannels

    async fn Client::pubsub_shardchannels(self : Client, pattern? : String) -> Result[Array[String], String]

    查看订阅与发布系统状态 PUBSUB SHARDCHANNELS [pattern] - 列出分片频道

    Client::pubsub_shardnumsub

    async fn Client::pubsub_shardnumsub(self : Client, channels? : Array[String]) -> Result[Array[String], String]

    查看订阅与发布系统状态 PUBSUB SHARDNUMSUB [channel [channel ...]] - 返回分片频道订阅者数量

    Client::punsubscribe

    async fn Client::punsubscribe(self : Client, patterns? : Array[String]) -> Result[Array[String], String]

    取消订阅模式 如果不指定模式,则取消所有模式订阅

    Client::quit

    async fn Client::quit(self : Client) -> Result[String, String]

    Client::randomkey

    async fn Client::randomkey(self : Client) -> Result[String?, String]

    Client::read

    async fn Client::read(self : Client, buf : FixedArray[Byte]) -> Int

    Client::read_redis_value

    async fn Client::read_redis_value(self : Client) -> RedisValue

    读取Redis响应并解析为RedisValue类型

    Client::read_response

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

    Return the payload of the next reply as text. Kept for source compatibility; send and read_redis_value give the framed, typed result.

    Client::rename

    async fn Client::rename(self : Client, key : String, newkey : String) -> Result[String, String]

    Client::renamenx

    async fn Client::renamenx(self : Client, key : String, newkey : String) -> Result[Int, String]

    Client::replconf

    async fn Client::replconf(self : Client, option : String, value : String) -> RedisValue

    Client::replicaof

    async fn Client::replicaof(self : Client, host : String, port : String) -> RedisValue

    Client::reset

    async fn Client::reset(self : Client) -> Result[String, String]

    Client::restore

    async fn Client::restore(self : Client, key : String, ttl : String, serialized_value : String) -> Result[String, String]

    Client::role

    async fn Client::role(self : Client) -> RedisValue

    Client::rpop

    async fn Client::rpop(self : Client, key : String) -> Result[String, String]

    Client::rpoplpush

    async fn Client::rpoplpush(self : Client, source : String, destination : String) -> RedisValue

    Client::rpush

    async fn Client::rpush(self : Client, key : String, values : Array[String]) -> Result[Int, String]

    Client::rpushx

    async fn Client::rpushx(self : Client, key : String, values : Array[String]) -> Result[Int, String]

    Client::sadd

    async fn Client::sadd(self : Client, key : String, members : Array[String]) -> Result[Int, String]

    Client::save

    async fn Client::save(self : Client) -> RedisValue

    Client::scan

    async fn Client::scan(self : Client, cursor : String) -> Result[Array[String], String]

    Client::scard

    async fn Client::scard(self : Client, key : String) -> Result[Int, String]

    Client::sdiff

    async fn Client::sdiff(self : Client, keys : Array[String]) -> Result[Array[String], String]

    Client::sdiffstore

    async fn Client::sdiffstore(self : Client, destination : String, keys : Array[String]) -> Result[Int, String]

    Client::select

    async fn Client::select(self : Client, index : String) -> Result[String, String]

    Client::send

    async fn Client::send(self : Client, args : Array[String]) -> RedisValue

    Client::set

    async fn Client::set(self : Client, key : String, value : String, condition? : SetCondition, get? : Bool, expiration? : SetExpiration) -> Result[String, String]

    基本的 SET 命令

    Client::setbit

    async fn Client::setbit(self : Client, key : String, offset : Int, value : Bit) -> Result[Int, String]

    Client::setex

    async fn Client::setex(self : Client, key : String, seconds : String, value : String) -> Result[String, String]

    Client::setnx

    async fn Client::setnx(self : Client, key : String, value : String) -> Result[Int, String]

    Client::setrange

    async fn Client::setrange(self : Client, key : String, offset : String, value : String) -> Result[Int, String]

    Client::shutdown

    async fn Client::shutdown(self : Client) -> RedisValue

    Client::sinter

    async fn Client::sinter(self : Client, keys : Array[String]) -> Result[Int, String]

    Client::sintercard

    async fn Client::sintercard(self : Client, numkeys : String, keys : Array[String]) -> Result[Int, String]

    Client::sinterstore

    async fn Client::sinterstore(self : Client, destination : String, keys : Array[String]) -> Result[Int, String]

    Client::sismember

    async fn Client::sismember(self : Client, key : String, value : String) -> Result[Int, String]

    Client::slaveof

    async fn Client::slaveof(self : Client, host : String, port : String) -> RedisValue

    Client::slowlog_get

    async fn Client::slowlog_get(self : Client) -> RedisValue

    Client::slowlog_len

    async fn Client::slowlog_len(self : Client) -> RedisValue

    Client::slowlog_reset

    async fn Client::slowlog_reset(self : Client) -> RedisValue

    Client::smembers

    async fn Client::smembers(self : Client, key : String) -> Result[Array[String], String]

    Client::smismember

    async fn Client::smismember(self : Client, key : String, members : Array[String]) -> Result[Array[String], String]

    Client::smove

    async fn Client::smove(self : Client, source : String, destination : String, value : String) -> Result[Int, String]

    Client::sort

    async fn Client::sort(self : Client, key : String) -> Result[Array[String], String]

    Client::sort_ro

    async fn Client::sort_ro(self : Client, key : String) -> Result[Array[String], String]

    Client::spop

    async fn Client::spop(self : Client, key : String) -> Result[String, String]

    Client::spublish

    async fn Client::spublish(self : Client, channel : String, message : String) -> Result[Int, String]

    发布消息到分片频道 返回接收到消息的订阅者数量

    Client::srandmember

    async fn Client::srandmember(self : Client, key : String) -> Result[String, String]

    Client::srem

    async fn Client::srem(self : Client, key : String, members : Array[String]) -> Result[Int, String]

    Client::sscan

    async fn Client::sscan(self : Client, key : String, cursor : Int, match_pattern? : String, count? : Int) -> Result[Array[String], String]

    Client::ssubscribe

    async fn Client::ssubscribe(self : Client, channels : Array[String]) -> Result[Array[String], String]

    订阅分片频道 返回订阅确认信息数组

    Client::strlen

    async fn Client::strlen(self : Client, key : String) -> Result[Int, String]

    Client::subscribe

    async fn Client::subscribe(self : Client, channels : Array[String]) -> Result[Array[String], String]

    订阅一个或多个频道 返回订阅确认信息数组

    Client::substr

    async fn Client::substr(self : Client, key : String, start : Int, end : Int) -> Result[String, String]

    Client::sunion

    async fn Client::sunion(self : Client, keys : Array[String]) -> Result[Int, String]

    Client::sunionstore

    async fn Client::sunionstore(self : Client, destination : String, keys : Array[String]) -> Result[Int, String]

    Client::sunsubscribe

    async fn Client::sunsubscribe(self : Client, channels? : Array[String]) -> Result[Array[String], String]

    取消订阅分片频道 如果不指定频道,则取消所有分片频道订阅

    Client::swapdb

    async fn Client::swapdb(self : Client, index1 : String, index2 : String) -> Result[String, String]

    Client::sync

    async fn Client::sync(self : Client) -> RedisValue

    Client::time

    async fn Client::time(self : Client) -> RedisValue

    Client::touch

    async fn Client::touch(self : Client, keys : Array[String]) -> Result[Int, String]

    Client::ttl

    async fn Client::ttl(self : Client, key : String) -> Result[Int, String]

    Client::type_

    async fn Client::type_(self : Client, key : String) -> Result[String, String]

    async fn Client::unlink(self : Client, keys : Array[String]) -> Result[Int, String]

    Client::unsubscribe

    async fn Client::unsubscribe(self : Client, channels? : Array[String]) -> Result[Array[String], String]

    取消订阅频道 如果不指定频道,则取消所有订阅

    Client::wait

    async fn Client::wait(self : Client, numreplicas : String, timeout : String) -> Result[Int, String]

    Client::waitaof

    async fn Client::waitaof(self : Client, numlocal : String, numreplicas : String, timeout : String) -> Result[Int, String]

    Client::write

    async fn Client::write(self : Client, data : String) -> Unit

    Client::xack

    async fn Client::xack(self : Client, key : String, group : String, ids : Array[String]) -> Result[Int, String]

    确认消息

    Client::xadd

    async fn Client::xadd(self : Client, key : String, id : String, field_values : Map[String, String]) -> Result[String, String]

    添加条目到流

    Client::xautoclaim

    async fn Client::xautoclaim(self : Client, key : String, group : String, consumer : String, min_idle_time : Int, start~ : String, count? : Int) -> Result[Array[String], String]

    自动声明消息

    Client::xclaim

    async fn Client::xclaim(self : Client, key : String, group : String, consumer : String, min_idle_time : Int, ids : Array[String]) -> Result[Array[String], String]

    声明消息

    Client::xdel

    async fn Client::xdel(self : Client, key : String, ids : Array[String]) -> Result[Int, String]

    删除流条目

    Client::xgroup_create

    async fn Client::xgroup_create(self : Client, key : String, group : String, id : String, mkstream : Bool) -> Result[String, String]

    创建消费者组

    Client::xgroup_createconsumer

    async fn Client::xgroup_createconsumer(self : Client, key : String, group : String, consumer : String) -> Result[Int, String]

    创建消费者

    Client::xgroup_delconsumer

    async fn Client::xgroup_delconsumer(self : Client, key : String, group : String, consumer : String) -> Result[Int, String]

    删除消费者

    Client::xgroup_destroy

    async fn Client::xgroup_destroy(self : Client, key : String, group : String) -> Result[Int, String]

    销毁消费者组

    Client::xgroup_setid

    async fn Client::xgroup_setid(self : Client, key : String, group : String, id : String) -> Result[String, String]

    设置消费者组ID

    Client::xinfo_consumers

    async fn Client::xinfo_consumers(self : Client, key : String, group : String) -> Result[Array[String], String]

    获取消费者信息

    Client::xinfo_groups

    async fn Client::xinfo_groups(self : Client, key : String) -> Result[Array[String], String]

    获取消费者组信息

    Client::xinfo_stream

    async fn Client::xinfo_stream(self : Client, key : String) -> Result[Array[String], String]

    获取流信息

    Client::xlen

    async fn Client::xlen(self : Client, key : String) -> Result[Int, String]

    获取流长度

    Client::xpending

    async fn Client::xpending(self : Client, key : String, group : String) -> Result[Array[String], String]

    查看待处理消息

    Client::xpending_range

    async fn Client::xpending_range(self : Client, key : String, group : String, start~ : String, end~ : String, count~ : Int, consumer? : String) -> Result[Array[String], String]

    查看待处理消息详情

    Client::xrange

    async fn Client::xrange(self : Client, key : String, start~ : String, end~ : String, count? : Int) -> Result[Array[RedisStreamMessage], String]

    范围查询流条目

    Client::xread

    async fn Client::xread(self : Client, count? : Int, block? : Int, streams : Array[(String, String)]) -> Result[RedisStream, String]

    读取流条目

    Client::xreadgroup

    async fn Client::xreadgroup(self : Client, group : String, consumer : String, count? : Int, block? : Int, noack? : Bool, streams : Array[(String, String)]) -> Result[RedisStream, String]

    消费者组读取

    Client::xrevrange

    async fn Client::xrevrange(self : Client, key : String, end~ : String, start~ : String, count? : Int) -> Result[Array[RedisStreamMessage], String]

    反向范围查询流条目

    Client::xtrim

    async fn Client::xtrim(self : Client, key : String, strategy~ : XTrimStrategy, threshold~ : Int64, approximate? : Bool, limit? : Int, keepref? : Bool, delref? : Bool, acked? : Bool) -> Result[Int, String]

    修剪流

    Client::zadd

    async fn Client::zadd(self : Client, key : String, zadd_members : Array[ZAddMember]) -> Result[Int, String]

    Client::zcard

    async fn Client::zcard(self : Client, key : String) -> Result[Int, String]

    Client::zcount

    async fn Client::zcount(self : Client, key : String, min~ : String, max~ : String) -> Result[Int, String]

    Client::zdiff

    async fn Client::zdiff(self : Client, numkeys : String, keys : Array[String]) -> Result[Array[String], String]

    Client::zdiffstore

    async fn Client::zdiffstore(self : Client, destination : String, numkeys : String, keys : Array[String]) -> Result[Int, String]

    Client::zincrby

    async fn Client::zincrby(self : Client, key : String, increment~ : String, value~ : String) -> Result[String, String]

    Client::zinter

    async fn Client::zinter(self : Client, numkeys : String, keys : Array[String]) -> Result[Array[String], String]

    Client::zintercard

    async fn Client::zintercard(self : Client, numkeys : String, keys : Array[String]) -> Result[Int, String]

    Client::zinterstore

    async fn Client::zinterstore(self : Client, destination : String, numkeys : String, keys : Array[String]) -> Result[Int, String]

    Client::zlexcount

    async fn Client::zlexcount(self : Client, key : String, min~ : String, max~ : String) -> Result[Int, String]

    Client::zmpop

    async fn Client::zmpop(self : Client, numkeys : String, keys : Array[String], value : String) -> Result[Array[String], String]

    Client::zmscore

    async fn Client::zmscore(self : Client, key : String, members : Array[String]) -> Result[Array[String], String]

    Client::zpopmax

    async fn Client::zpopmax(self : Client, key : String) -> Result[String, String]

    Client::zpopmin

    async fn Client::zpopmin(self : Client, key : String) -> Result[String, String]

    Client::zrandmember

    async fn Client::zrandmember(self : Client, key : String) -> Result[String, String]

    Client::zrange

    async fn Client::zrange(self : Client, key : String, start~ : String, stop~ : String) -> Result[Array[String], String]

    Client::zrangebylex

    async fn Client::zrangebylex(self : Client, key : String, min~ : String, max~ : String) -> Result[Array[String], String]

    Client::zrangebyscore

    async fn Client::zrangebyscore(self : Client, key : String, min~ : String, max~ : String) -> Result[Array[String], String]

    Client::zrangestore

    async fn Client::zrangestore(self : Client, dst : String, src : String, min~ : String, max~ : String) -> Result[Int, String]

    Client::zrank

    async fn Client::zrank(self : Client, key : String, value : String) -> Result[Int, String]

    Client::zrem

    async fn Client::zrem(self : Client, key : String, members : Array[String]) -> Result[Int, String]

    Client::zremrangebylex

    async fn Client::zremrangebylex(self : Client, key : String, min : String, max : String) -> Result[Int, String]

    Client::zremrangebyrank

    async fn Client::zremrangebyrank(self : Client, key : String, start : String, stop : String) -> Result[Int, String]

    Client::zremrangebyscore

    async fn Client::zremrangebyscore(self : Client, key : String, min : String, max : String) -> Result[Int, String]

    Client::zrevrange

    async fn Client::zrevrange(self : Client, key : String, start~ : String, stop~ : String) -> Result[Array[String], String]

    Client::zrevrangebylex

    async fn Client::zrevrangebylex(self : Client, key : String, max~ : String, min~ : String) -> Result[Array[String], String]

    Client::zrevrangebyscore

    async fn Client::zrevrangebyscore(self : Client, key : String, max~ : String, min~ : String) -> Result[Array[String], String]

    Client::zrevrank

    async fn Client::zrevrank(self : Client, key : String, value : String) -> Result[Int, String]

    Client::zscan

    async fn Client::zscan(self : Client, key : String, cursor : String) -> Result[Array[String], String]

    Client::zscore

    async fn Client::zscore(self : Client, key : String, value : String) -> Result[String, String]

    Client::zunion

    async fn Client::zunion(self : Client, numkeys : String, keys : Array[String]) -> Result[Array[String], String]

    Client::zunionstore

    async fn Client::zunionstore(self : Client, destination : String, numkeys : String, keys : Array[String]) -> Result[Int, String]

    GeoCoordinates

    pub(all) struct GeoCoordinates {
    longitude : Double
    latitude : Double
    }

    GeoCoordinates::to_array

    fn GeoCoordinates::to_array(self : GeoCoordinates) -> Array[String]

    GeoSearchByBox

    pub(all) struct GeoSearchByBox {
    width : Int
    height : Int
    unit : GeoUnits
    }

    GeoSearchByBox::to_array

    fn GeoSearchByBox::to_array(self : GeoSearchByBox) -> Array[String]

    GeoUnits

    pub(all) enum GeoUnits {
    Meters
    Kilometers
    Miles
    Feet
    }

    impl Show for GeoUnits

    GeoUnits::output

    fn GeoUnits::output(self : GeoUnits, logger : &Logger) -> Unit

    GeoUnits::to_string

    fn GeoUnits::to_string(self : GeoUnits) -> String

    RedisStream

    pub(all) struct RedisStream {
    name : String
    messages : Array[RedisStreamMessage]
    } derive(
    Debug
    )

    impl Show for RedisStream

    RedisStream::output

    fn RedisStream::output(self : RedisStream, logger : &Logger) -> Unit

    RedisStream::to_repr

    automatically derived

    RedisStream::to_string

    fn RedisStream::to_string(self : RedisStream) -> String

    RedisStreamMessage

    pub(all) struct RedisStreamMessage {
    id : String
    fields : Array[String]
    } derive(
    Debug
    )

    RedisStreamMessage::output

    fn RedisStreamMessage::output(self : RedisStreamMessage, logger : &Logger) -> Unit

    RedisStreamMessage::to_repr

    automatically derived

    RedisStreamMessage::to_string

    fn RedisStreamMessage::to_string(self : RedisStreamMessage) -> String

    RedisValue

    pub(all) enum RedisValue {
    SimpleString(String)
    Error(String)
    Integer(Int)
    BulkString(String?)
    Array(Array[RedisValue])
    } derive(Eq, Hash,
    Debug
    )

    Redis响应的基本类型
    impl Show for RedisValue

    RedisValue::equal

    fn RedisValue::equal(RedisValue, RedisValue) -> Bool
    automatically derived

    RedisValue::hash

    fn RedisValue::hash(self : RedisValue) -> Int
    automatically derived

    RedisValue::hash_combine

    fn RedisValue::hash_combine(RedisValue, Hasher) -> Unit
    automatically derived

    RedisValue::not_equal

    fn RedisValue::not_equal(x : RedisValue, y : RedisValue) -> Bool
    automatically derived

    RedisValue::output

    fn RedisValue::output(self : RedisValue, logger : &Logger) -> Unit

    RedisValue::to_array

    fn RedisValue::to_array(self : RedisValue) -> Result[Array[String], String]

    将RedisValue转换为数组

    RedisValue::to_bool

    fn RedisValue::to_bool(self : RedisValue) -> Result[Bool, String]

    将RedisValue转换为布尔值

    RedisValue::to_bulk_string

    fn RedisValue::to_bulk_string(self : RedisValue) -> Result[String?, String]

    将RedisValue转换为具体类型

    RedisValue::to_int

    fn RedisValue::to_int(self : RedisValue) -> Result[Int, String]

    将RedisValue转换为整数

    RedisValue::to_json

    将RedisValue转换为JSON

    RedisValue::to_repr

    automatically derived

    RedisValue::to_stream

    fn RedisValue::to_stream(self : RedisValue) -> Result[RedisStream, String]

    RedisValue::to_stream_message_array

    fn RedisValue::to_stream_message_array(self : RedisValue) -> Result[Array[RedisStreamMessage], String]

    将RedisValue转换为Stream消息数组(用于XRANGE等命令)

    RedisValue::to_string

    fn RedisValue::to_string(self : RedisValue) -> Result[String, String]

    将RedisValue转换为具体类型

    SetCondition

    pub(all) enum SetCondition {
    NX
    XX
    IFEQ(String)
    }

    SET 命令的条件选项

    SetExpiration

    pub(all) enum SetExpiration {
    EX(Int)
    PX(Int)
    EXAT(Int)
    PXAT(Int)
    KEEPTTL
    }

    SET 命令的过期时间选项

    XTrimStrategy

    pub(all) enum XTrimStrategy {
    MaxLen
    MinID
    }

    ZAddMember

    pub(all) struct ZAddMember {
    score : String
    value : String
    }

    connect

    #deprecated("Use `@redis.Client` instead of `@redis.Client` to create a RedisClient.")
    async fn connect(host : StringView, port? : Int, protocol? :
    IpProtocolPreference
    , username? : String, password? : String, db? : Int) -> Client

    parse_redis_response

    fn parse_redis_response(response : String) -> RedisValue

    Parse a complete RESP2 reply held in response.

    Frame lengths are byte counts, so the text is re-encoded to UTF-8 before being walked. An input that stops mid-frame yields Error("Incomplete RESP reply") rather than a silently shortened value.