// ============ 列表命令 ============
///|
pub async fn Client::lpush(
self : Client,
key : String,
values : Array[String],
) -> RedisInt {
let args = ["LPUSH", key, ..values]
self.send(args).to_int()
}
///|
pub async fn Client::rpush(
self : Client,
key : String,
values : Array[String],
) -> RedisInt {
let args = ["RPUSH", key, ..values]
self.send(args).to_int()
}
///|
pub async fn Client::lpop(self : Client, key : String) -> RedisString {
self.send(["LPOP", key]).to_string()
}
///|
pub async fn Client::rpop(self : Client, key : String) -> RedisString {
self.send(["RPOP", key]).to_string()
}
///|
pub async fn Client::lpushx(
self : Client,
key : String,
values : Array[String],
) -> RedisInt {
let args = ["LPUSHX", key, ..values]
self.send(args).to_int()
}
///|
pub async fn Client::rpushx(
self : Client,
key : String,
values : Array[String],
) -> RedisInt {
let args = ["RPUSHX", key, ..values]
self.send(args).to_int()
}
///|
pub async fn Client::llen(self : Client, key : String) -> RedisInt {
self.send(["LLEN", key]).to_int()
}
///|
pub async fn Client::lrange(
self : Client,
key : String,
start~ : Int32,
stop~ : Int32,
) -> RedisArray {
self.send(["LRANGE", key, start.to_string(), stop.to_string()]).to_array()
}
///|
pub async fn Client::lindex(
self : Client,
key : String,
index~ : Int32,
) -> RedisString {
self.send(["LINDEX", key, index.to_string()]).to_string()
}
///|
pub async fn Client::lset(
self : Client,
key : String,
index~ : Int32,
value~ : String,
) -> RedisString {
self.send(["LSET", key, index.to_string(), value]).to_string()
}
///|
pub async fn Client::lrem(
self : Client,
key : String,
count~ : Int32,
value~ : String,
) -> RedisInt {
self.send(["LREM", key, count.to_string(), value]).to_int()
}
///|
pub async fn Client::ltrim(
self : Client,
key : String,
start~ : Int32,
stop~ : Int32,
) -> RedisString {
self.send(["LTRIM", key, start.to_string(), stop.to_string()]).to_string()
}
///|
pub async fn Client::linsert(
self : Client,
key : String,
where_~ : String,
pivot~ : String,
element~ : String,
) -> RedisInt {
self.send(["LINSERT", key, where_, pivot, element]).to_int()
}
///|
pub async fn Client::rpoplpush(
self : Client,
source : String,
destination : String,
) -> RedisValue {
self.send(["RPOPLPUSH", source, destination])
}
///|
pub async fn Client::lmove(
self : Client,
source : String,
destination : String,
wherefrom~ : Int32,
whereto~ : Int32,
) -> RedisValue {
self.send([
"LMOVE",
source,
destination,
wherefrom.to_string(),
whereto.to_string(),
])
}
///|
pub async fn Client::lpos(
self : Client,
key : String,
element~ : String,
) -> RedisValue {
self.send(["LPOS", key, element])
}
///|
pub async fn Client::blpop(
self : Client,
keys : Array[String],
timeout~ : Int32,
) -> RedisValue {
let args = ["BLPOP", ..keys, timeout.to_string()]
self.send(args)
}
///|
pub async fn Client::brpop(
self : Client,
keys : Array[String],
timeout~ : Int32,
) -> RedisValue {
let args = ["BRPOP", ..keys, timeout.to_string()]
self.send(args)
}
///|
pub async fn Client::brpoplpush(
self : Client,
source : String,
destination : String,
timeout~ : Int32,
) -> RedisValue {
self.send(["BRPOPLPUSH", source, destination, timeout.to_string()])
}
///|
pub async fn Client::blmove(
self : Client,
source : String,
destination : String,
wherefrom~ : Int32,
whereto~ : Int32,
timeout~ : Int32,
) -> RedisValue {
self.send([
"BLMOVE",
source,
destination,
wherefrom.to_string(),
whereto.to_string(),
timeout.to_string(),
])
}
///|
pub async fn Client::lmpop(
self : Client,
numkeys : String,
keys : Array[String],
where_~ : String,
) -> RedisValue {
let args = ["LMPOP", numkeys, ..keys, where_]
self.send(args)
}
///|
pub async fn Client::blmpop(
self : Client,
timeout~ : Int32,
numkeys : String,
keys : Array[String],
where_~ : String,
) -> RedisValue {
let args = ["BLMPOP", timeout.to_string(), numkeys, ..keys, where_]
self.send(args)
}