Skip to main content

RedisServerConfig

Struct RedisServerConfig 

Source
pub struct RedisServerConfig {
Show 37 fields pub port: u16, pub bind: String, pub protected_mode: bool, pub tcp_backlog: Option<u32>, pub unixsocket: Option<PathBuf>, pub unixsocketperm: Option<u32>, pub timeout: Option<u32>, pub tcp_keepalive: Option<u32>, pub tls_port: Option<u16>, pub tls_cert_file: Option<PathBuf>, pub tls_key_file: Option<PathBuf>, pub tls_ca_cert_file: Option<PathBuf>, pub tls_auth_clients: Option<bool>, pub daemonize: bool, pub dir: PathBuf, pub logfile: Option<String>, pub loglevel: LogLevel, pub databases: Option<u32>, pub maxmemory: Option<String>, pub maxmemory_policy: Option<String>, pub maxclients: Option<u32>, pub save: bool, pub appendonly: bool, pub replicaof: Option<(String, u16)>, pub masterauth: Option<String>, pub password: Option<String>, pub acl_file: Option<PathBuf>, pub cluster_enabled: bool, pub cluster_node_timeout: Option<u64>, pub loadmodule: Vec<PathBuf>, pub hz: Option<u32>, pub io_threads: Option<u32>, pub io_threads_do_reads: Option<bool>, pub notify_keyspace_events: Option<String>, pub extra: HashMap<String, String>, pub redis_server_bin: String, pub redis_cli_bin: String,
}
Expand description

Full configuration snapshot for a single redis-server process.

This struct is populated by the RedisServer builder and passed to RedisServer::start. You rarely need to construct it directly; use the builder instead.

§Example

use redis_server_wrapper::RedisServer;

let server = RedisServer::new()
    .port(6400)
    .bind("127.0.0.1")
    .save(false)
    .start()
    .await
    .unwrap();

assert!(server.is_alive().await);
// Stopped automatically on Drop.

Fields§

§port: u16

TCP port the server listens on (default: 6379).

§bind: String

IP address to bind (default: "127.0.0.1").

§protected_mode: bool

Whether protected mode is enabled (default: false).

§tcp_backlog: Option<u32>

TCP backlog queue length, if set.

§unixsocket: Option<PathBuf>

Unix domain socket path, if set.

§unixsocketperm: Option<u32>

Unix socket file permissions (e.g. 700), if set.

§timeout: Option<u32>

Idle client timeout in seconds (0 = disabled), if set.

§tcp_keepalive: Option<u32>

TCP keepalive interval in seconds, if set.

§tls_port: Option<u16>

TLS listening port, if set.

§tls_cert_file: Option<PathBuf>

Path to the TLS certificate file, if set.

§tls_key_file: Option<PathBuf>

Path to the TLS private key file, if set.

§tls_ca_cert_file: Option<PathBuf>

Path to the TLS CA certificate file, if set.

§tls_auth_clients: Option<bool>

Whether TLS client authentication is required, if set.

§daemonize: bool

Whether the server daemonizes itself (default: true).

§dir: PathBuf

Working directory for data files (default: a sub-directory of $TMPDIR).

§logfile: Option<String>

Path to the log file, if set. Defaults to redis.log inside the node directory.

§loglevel: LogLevel

Server log verbosity (default: LogLevel::Notice).

§databases: Option<u32>

Number of databases, if set (Redis default: 16).

§maxmemory: Option<String>

Maximum memory limit (e.g. "256mb"), if set.

§maxmemory_policy: Option<String>

Eviction policy when maxmemory is reached, if set.

§maxclients: Option<u32>

Maximum number of simultaneous client connections, if set.

§save: bool

Whether RDB snapshots are enabled (default: false).

§appendonly: bool

Whether AOF persistence is enabled (default: false).

§replicaof: Option<(String, u16)>

Master host and port to replicate from, if set.

§masterauth: Option<String>

Password for authenticating with a master, if set.

§password: Option<String>

requirepass password for client connections, if set.

§acl_file: Option<PathBuf>

Path to an ACL file, if set.

§cluster_enabled: bool

Whether Redis Cluster mode is enabled (default: false).

§cluster_node_timeout: Option<u64>

Cluster node timeout in milliseconds, if set.

§loadmodule: Vec<PathBuf>

List of Redis module paths to load at startup.

§hz: Option<u32>

Server tick frequency in Hz, if set (Redis default: 10).

§io_threads: Option<u32>

Number of I/O threads, if set.

§io_threads_do_reads: Option<bool>

Whether I/O threads also handle reads, if set.

§notify_keyspace_events: Option<String>

Keyspace notification event mask (e.g. "KEA"), if set.

§extra: HashMap<String, String>

Arbitrary key/value directives forwarded verbatim to the config file.

§redis_server_bin: String

Path to the redis-server binary (default: "redis-server").

§redis_cli_bin: String

Path to the redis-cli binary (default: "redis-cli").

Trait Implementations§

Source§

impl Clone for RedisServerConfig

Source§

fn clone(&self) -> RedisServerConfig

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for RedisServerConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for RedisServerConfig

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.