// ============ 通用命令 ============
///|
pub async fn Client::del(self : Client, keys : Array[String]) -> RedisInt {
let args = ["DEL", ..keys]
self.send(args).to_int()
}
///|
pub async fn Client::unlink(self : Client, keys : Array[String]) -> RedisInt {
let args = ["UNLINK", ..keys]
self.send(args).to_int()
}
///|
pub async fn Client::exists(self : Client, keys : Array[String]) -> RedisInt {
let args = ["EXISTS", ..keys]
self.send(args).to_int()
}
///|
pub async fn Client::expire(
self : Client,
key : String,
seconds : String,
) -> RedisInt {
self.send(["EXPIRE", key, seconds]).to_int()
}
///|
pub async fn Client::expireat(
self : Client,
key : String,
timestamp : String,
) -> RedisInt {
self.send(["EXPIREAT", key, timestamp]).to_int()
}
///|
pub async fn Client::expiretime(self : Client, key : String) -> RedisInt {
self.send(["EXPIRETIME", key]).to_int()
}
///|
pub async fn Client::pexpire(
self : Client,
key : String,
milliseconds : String,
) -> RedisInt {
self.send(["PEXPIRE", key, milliseconds]).to_int()
}
///|
pub async fn Client::pexpireat(
self : Client,
key : String,
timestamp : String,
) -> RedisInt {
self.send(["PEXPIREAT", key, timestamp]).to_int()
}
///|
pub async fn Client::pexpiretime(self : Client, key : String) -> RedisInt {
self.send(["PEXPIRETIME", key]).to_int()
}
///|
pub async fn Client::ttl(self : Client, key : String) -> RedisInt {
self.send(["TTL", key]).to_int()
}
///|
pub async fn Client::pttl(self : Client, key : String) -> RedisInt {
self.send(["PTTL", key]).to_int()
}
///|
pub async fn Client::persist(self : Client, key : String) -> RedisInt {
self.send(["PERSIST", key]).to_int()
}
///|
pub async fn Client::keys(self : Client, pattern : String) -> RedisArray {
self.send(["KEYS", pattern]).to_array()
}
///|
pub async fn Client::scan(self : Client, cursor : String) -> RedisArray {
self.send(["SCAN", cursor]).to_array()
}
///|
pub async fn Client::randomkey(self : Client) -> RedisBulkString {
self.send(["RANDOMKEY"]).to_bulk_string()
}
///|
pub async fn Client::rename(
self : Client,
key : String,
newkey : String,
) -> RedisString {
self.send(["RENAME", key, newkey]).to_string()
}
///|
pub async fn Client::renamenx(
self : Client,
key : String,
newkey : String,
) -> RedisInt {
self.send(["RENAMENX", key, newkey]).to_int()
}
///|
pub async fn Client::type_(self : Client, key : String) -> RedisString {
self.send(["TYPE", key]).to_string()
}
///|
pub async fn Client::sort(self : Client, key : String) -> RedisArray {
self.send(["SORT", key]).to_array()
}
///|
pub async fn Client::sort_ro(self : Client, key : String) -> RedisArray {
self.send(["SORT_RO", key]).to_array()
}
///|
pub async fn Client::copy(
self : Client,
source : String,
destination : String,
) -> RedisInt {
self.send(["COPY", source, destination]).to_int()
}
///|
pub async fn Client::move_(
self : Client,
key : String,
db : String,
) -> RedisInt {
self.send(["MOVE", key, db]).to_int()
}
///|
pub async fn Client::swapdb(
self : Client,
index1 : String,
index2 : String,
) -> RedisString {
self.send(["SWAPDB", index1, index2]).to_string()
}
///|
pub async fn Client::touch(self : Client, keys : Array[String]) -> RedisInt {
let args = ["TOUCH", ..keys]
self.send(args).to_int()
}
///|
pub async fn Client::dump(self : Client, key : String) -> RedisBulkString {
self.send(["DUMP", key]).to_bulk_string()
}
///|
pub async fn Client::restore(
self : Client,
key : String,
ttl : String,
serialized_value : String,
) -> RedisString {
self.send(["RESTORE", key, ttl, serialized_value]).to_string()
}
///|
pub async fn Client::migrate(
self : Client,
host : String,
port : String,
key : String,
destination_db : String,
timeout : String,
) -> RedisString {
self.send(["MIGRATE", host, port, key, destination_db, timeout]).to_string()
}
///|
pub async fn Client::object_encoding(
self : Client,
key : String,
) -> RedisBulkString {
self.send(["OBJECT", "ENCODING", key]).to_bulk_string()
}
///|
pub async fn Client::object_freq(self : Client, key : String) -> RedisInt {
self.send(["OBJECT", "FREQ", key]).to_int()
}
///|
pub async fn Client::object_idletime(self : Client, key : String) -> RedisInt {
self.send(["OBJECT", "IDLETIME", key]).to_int()
}
///|
pub async fn Client::object_refcount(self : Client, key : String) -> RedisInt {
self.send(["OBJECT", "REFCOUNT", key]).to_int()
}
///|
pub async fn Client::flushdb(self : Client) -> RedisString {
self.send(["FLUSHDB"]).to_string()
}
///|
pub async fn Client::flushall(self : Client) -> RedisString {
self.send(["FLUSHALL"]).to_string()
}
///|
pub async fn Client::dbsize(self : Client) -> RedisInt {
self.send(["DBSIZE"]).to_int()
}
///|
pub async fn Client::wait(
self : Client,
numreplicas : String,
timeout : String,
) -> RedisInt {
self.send(["WAIT", numreplicas, timeout]).to_int()
}
///|
pub async fn Client::waitaof(
self : Client,
numlocal : String,
numreplicas : String,
timeout : String,
) -> RedisInt {
self.send(["WAITAOF", numlocal, numreplicas, timeout]).to_int()
}