Skip to main content

ValkeyConfig

Struct ValkeyConfig 

Source
pub struct ValkeyConfig { /* private fields */ }
Expand description

Validated Valkey client configuration.

Implementations§

Source§

impl ValkeyConfig

Source

pub fn new(input: ValkeyConfigInput) -> ValkeyResult<Self>

Validates and constructs Valkey configuration.

Source

pub fn from_env_prefix(prefix: &str) -> ValkeyResult<Self>

Builds configuration from process environment variables using a prefix.

For prefix = "EXAMPLE_SEARCH", this reads the required EXAMPLE_SEARCH_VALKEY_HOST and optional VALKEY_PORT, VALKEY_DATABASE, VALKEY_USERNAME, VALKEY_PASSWORD, VALKEY_KEY_PREFIX, VALKEY_TLS_MODE, and bounded connection-manager policy variables with the same prefix. TLS defaults to required and plaintext requires the exact allow-plaintext-development value.

Source

pub fn host(&self) -> &str

Returns the server hostname or IP address.

Source

pub const fn port(&self) -> u16

Returns the server TCP port.

Source

pub const fn database(&self) -> u32

Returns the logical database number.

Source

pub const fn username(&self) -> Option<&SecretString>

Returns the optional ACL username.

Source

pub const fn password(&self) -> Option<&SecretString>

Returns the optional password or access token.

Source

pub fn key_prefix(&self) -> &str

Returns the key namespace prefix.

Source

pub const fn transport_security(&self) -> ValkeyTransportSecurity

Returns the transport security policy.

Source

pub const fn tls_trust(&self) -> &ValkeyTlsTrust

Returns the certificate trust policy used for TLS connections.

Source

pub const fn connection_timeout(&self) -> Duration

Returns the connection establishment deadline.

Source

pub const fn response_timeout(&self) -> Duration

Returns the command response deadline.

Source

pub const fn retry_attempts(&self) -> u32

Returns automatic reconnect attempts.

Source

pub const fn concurrency_limit(&self) -> u32

Returns the in-flight command ceiling.

Source

pub const fn pipeline_buffer_size(&self) -> u32

Returns the outbound pipeline queue bound.

Trait Implementations§

Source§

impl Debug for ValkeyConfig

Source§

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

Formats the value using the given formatter. 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> 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.