-
Notifications
You must be signed in to change notification settings - Fork 64
/
slowlog.rs
30 lines (24 loc) · 885 Bytes
/
slowlog.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
use super::*;
use crate::{
protocol::{command::CommandKind, utils as protocol_utils},
utils,
};
pub async fn slowlog_get<C: ClientLike>(client: &C, count: Option<i64>) -> Result<Value, Error> {
let frame = utils::request_response(client, move || {
let mut args = Vec::with_capacity(2);
args.push(static_val!(GET));
if let Some(count) = count {
args.push(count.into());
}
Ok((CommandKind::Slowlog, args))
})
.await?;
protocol_utils::frame_to_results(frame)
}
pub async fn slowlog_length<C: ClientLike>(client: &C) -> Result<Value, Error> {
let frame = utils::request_response(client, || Ok((CommandKind::Slowlog, vec![LEN.into()]))).await?;
protocol_utils::frame_to_results(frame)
}
pub async fn slowlog_reset<C: ClientLike>(client: &C) -> Result<(), Error> {
args_ok_cmd(client, CommandKind::Slowlog, vec![static_val!(RESET)]).await
}