pub struct RedisCli { /* private fields */ }Expand description
Builder for executing redis-cli commands.
Implementations§
Source§impl RedisCli
impl RedisCli
Sourcepub fn unixsocket(self, path: impl Into<PathBuf>) -> Self
pub fn unixsocket(self, path: impl Into<PathBuf>) -> Self
Connect via a Unix socket instead of TCP.
Sourcepub fn cacert(self, path: impl Into<PathBuf>) -> Self
pub fn cacert(self, path: impl Into<PathBuf>) -> Self
Set the CA certificate file for TLS verification.
Sourcepub fn cacertdir(self, path: impl Into<PathBuf>) -> Self
pub fn cacertdir(self, path: impl Into<PathBuf>) -> Self
Set the CA certificate directory for TLS verification.
Sourcepub fn tls_ciphers(self, ciphers: impl Into<String>) -> Self
pub fn tls_ciphers(self, ciphers: impl Into<String>) -> Self
Set the allowed TLS 1.2 ciphers (--tls-ciphers).
Sourcepub fn tls_ciphersuites(self, ciphersuites: impl Into<String>) -> Self
pub fn tls_ciphersuites(self, ciphersuites: impl Into<String>) -> Self
Set the allowed TLS 1.3 ciphersuites (--tls-ciphersuites).
Sourcepub fn uri(self, uri: impl Into<String>) -> Self
pub fn uri(self, uri: impl Into<String>) -> Self
Set the server URI (-u), e.g. redis://user:pass@host:port/db.
Sourcepub fn client_name(self, name: impl Into<String>) -> Self
pub fn client_name(self, name: impl Into<String>) -> Self
Set the client connection name (--name).
Sourcepub fn ip_preference(self, preference: IpPreference) -> Self
pub fn ip_preference(self, preference: IpPreference) -> Self
Set IP version preference for connections.
Sourcepub fn interval(self, seconds: f64) -> Self
pub fn interval(self, seconds: f64) -> Self
Set interval in seconds between repeated commands (-i).
Sourcepub fn resp(self, protocol: RespProtocol) -> Self
pub fn resp(self, protocol: RespProtocol) -> Self
Set the RESP protocol version.
Sourcepub fn cluster_mode(self, enable: bool) -> Self
pub fn cluster_mode(self, enable: bool) -> Self
Enable cluster mode (-c flag) for following redirects.
Sourcepub fn output_format(self, format: OutputFormat) -> Self
pub fn output_format(self, format: OutputFormat) -> Self
Set the output format.
Sourcepub fn no_auth_warning(self, suppress: bool) -> Self
pub fn no_auth_warning(self, suppress: bool) -> Self
Suppress the AUTH password warning.
Sourcepub fn stdin_last_arg(self, enable: bool) -> Self
pub fn stdin_last_arg(self, enable: bool) -> Self
Read last argument from stdin (-x).
Sourcepub fn stdin_tag_arg(self, enable: bool) -> Self
pub fn stdin_tag_arg(self, enable: bool) -> Self
Read tag argument from stdin (-X).
Sourcepub fn multi_bulk_delimiter(self, delim: impl Into<String>) -> Self
pub fn multi_bulk_delimiter(self, delim: impl Into<String>) -> Self
Set the multi-bulk delimiter (-d).
Sourcepub fn output_delimiter(self, delim: impl Into<String>) -> Self
pub fn output_delimiter(self, delim: impl Into<String>) -> Self
Set the output delimiter between responses (-D).
Sourcepub fn exit_error_code(self, enable: bool) -> Self
pub fn exit_error_code(self, enable: bool) -> Self
Return exit error code on server errors (-e).
Sourcepub fn quoted_input(self, enable: bool) -> Self
pub fn quoted_input(self, enable: bool) -> Self
Force input to be processed as quoted strings (--quoted-input).
Sourcepub fn show_pushes(self, enable: bool) -> Self
pub fn show_pushes(self, enable: bool) -> Self
Show or hide push messages (--show-pushes).
Sourcepub fn latency_history(self, enable: bool) -> Self
pub fn latency_history(self, enable: bool) -> Self
Enable latency history mode (--latency-history).
Sourcepub fn latency_dist(self, enable: bool) -> Self
pub fn latency_dist(self, enable: bool) -> Self
Enable latency distribution mode (--latency-dist).
Sourcepub fn memkeys_samples(self, n: u32) -> Self
pub fn memkeys_samples(self, n: u32) -> Self
Set the sample count for memkeys (--memkeys-samples).
Sourcepub fn keystats_samples(self, n: u32) -> Self
pub fn keystats_samples(self, n: u32) -> Self
Set the sample count for keystats (--keystats-samples).
Sourcepub fn pattern(self, pat: impl Into<String>) -> Self
pub fn pattern(self, pat: impl Into<String>) -> Self
Set a pattern filter for scan (--pattern).
Sourcepub fn quoted_pattern(self, pat: impl Into<String>) -> Self
pub fn quoted_pattern(self, pat: impl Into<String>) -> Self
Set a quoted pattern for scan (--quoted-pattern).
Sourcepub fn intrinsic_latency(self, seconds: u32) -> Self
pub fn intrinsic_latency(self, seconds: u32) -> Self
Measure intrinsic system latency for the given number of seconds.
Sourcepub fn lru_test(self, keys: u64) -> Self
pub fn lru_test(self, keys: u64) -> Self
Run LRU simulation test with the given number of keys.
Sourcepub fn ldb_sync_mode(self, enable: bool) -> Self
pub fn ldb_sync_mode(self, enable: bool) -> Self
Enable Lua debugger in synchronous mode (--ldb-sync-mode).
Sourcepub fn pipe_timeout(self, seconds: u32) -> Self
pub fn pipe_timeout(self, seconds: u32) -> Self
Set the pipe mode timeout in seconds (--pipe-timeout).
Sourcepub fn functions_rdb(self, path: impl Into<PathBuf>) -> Self
pub fn functions_rdb(self, path: impl Into<PathBuf>) -> Self
Transfer a functions-only RDB dump (--functions-rdb).
Sourcepub fn replica(self, enable: bool) -> Self
pub fn replica(self, enable: bool) -> Self
Simulate a replica for replication stream (--replica).
Sourcepub async fn cluster_command(
&self,
command: &str,
args: &[&str],
) -> Result<String>
pub async fn cluster_command( &self, command: &str, args: &[&str], ) -> Result<String>
Run a redis-cli --cluster <command> subcommand.
This is a general-purpose method for all cluster subcommands beyond
create (which has the dedicated cluster_create method).
Pass the subcommand and any additional arguments.
§Example
use redis_server_wrapper::RedisCli;
let cli = RedisCli::new().host("127.0.0.1").port(7000);
let info = cli.cluster_command("info", &["127.0.0.1:7000"]).await.unwrap();Sourcepub async fn run(&self, args: &[&str]) -> Result<String>
pub async fn run(&self, args: &[&str]) -> Result<String>
Run a command and return stdout on success.
Sourcepub fn fire_and_forget(&self, args: &[&str])
pub fn fire_and_forget(&self, args: &[&str])
Run a command, ignoring output. Used for fire-and-forget (SHUTDOWN).
Sourcepub async fn wait_for_ready(&self, timeout: Duration) -> Result<()>
pub async fn wait_for_ready(&self, timeout: Duration) -> Result<()>
Wait until the server responds to PING or timeout expires.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for RedisCli
impl RefUnwindSafe for RedisCli
impl Send for RedisCli
impl Sync for RedisCli
impl Unpin for RedisCli
impl UnsafeUnpin for RedisCli
impl UnwindSafe for RedisCli
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more