pub struct RedisServer { /* private fields */ }Expand description
Builder for a Redis server.
Implementations§
Source§impl RedisServer
impl RedisServer
Sourcepub fn protected_mode(self, protected: bool) -> Self
pub fn protected_mode(self, protected: bool) -> Self
Enable or disable protected mode (default: off).
Sourcepub fn tcp_backlog(self, backlog: u32) -> Self
pub fn tcp_backlog(self, backlog: u32) -> Self
Set the TCP backlog queue length.
Sourcepub fn unixsocket(self, path: impl Into<PathBuf>) -> Self
pub fn unixsocket(self, path: impl Into<PathBuf>) -> Self
Set a Unix socket path for connections.
Sourcepub fn unixsocketperm(self, perm: u32) -> Self
pub fn unixsocketperm(self, perm: u32) -> Self
Set Unix socket permissions (e.g. 700).
Sourcepub fn timeout(self, seconds: u32) -> Self
pub fn timeout(self, seconds: u32) -> Self
Close idle client connections after this many seconds (0 = disabled).
Sourcepub fn tcp_keepalive(self, seconds: u32) -> Self
pub fn tcp_keepalive(self, seconds: u32) -> Self
Set TCP keepalive interval in seconds.
Sourcepub fn tls_cert_file(self, path: impl Into<PathBuf>) -> Self
pub fn tls_cert_file(self, path: impl Into<PathBuf>) -> Self
Set the TLS certificate file path.
Sourcepub fn tls_key_file(self, path: impl Into<PathBuf>) -> Self
pub fn tls_key_file(self, path: impl Into<PathBuf>) -> Self
Set the TLS private key file path.
Sourcepub fn tls_ca_cert_file(self, path: impl Into<PathBuf>) -> Self
pub fn tls_ca_cert_file(self, path: impl Into<PathBuf>) -> Self
Set the TLS CA certificate file path.
Sourcepub fn tls_auth_clients(self, require: bool) -> Self
pub fn tls_auth_clients(self, require: bool) -> Self
Require TLS client authentication.
Sourcepub fn tls_key_file_pass(self, pass: impl Into<String>) -> Self
pub fn tls_key_file_pass(self, pass: impl Into<String>) -> Self
Set the passphrase for the TLS private key file.
Sourcepub fn tls_ca_cert_dir(self, path: impl Into<PathBuf>) -> Self
pub fn tls_ca_cert_dir(self, path: impl Into<PathBuf>) -> Self
Set the TLS CA certificate directory path.
Sourcepub fn tls_client_cert_file(self, path: impl Into<PathBuf>) -> Self
pub fn tls_client_cert_file(self, path: impl Into<PathBuf>) -> Self
Set the TLS client certificate file path (for outgoing connections).
Sourcepub fn tls_client_key_file(self, path: impl Into<PathBuf>) -> Self
pub fn tls_client_key_file(self, path: impl Into<PathBuf>) -> Self
Set the TLS client private key file path (for outgoing connections).
Sourcepub fn tls_client_key_file_pass(self, pass: impl Into<String>) -> Self
pub fn tls_client_key_file_pass(self, pass: impl Into<String>) -> Self
Set the passphrase for the TLS client private key file.
Sourcepub fn tls_dh_params_file(self, path: impl Into<PathBuf>) -> Self
pub fn tls_dh_params_file(self, path: impl Into<PathBuf>) -> Self
Set the DH parameters file path for DHE ciphers.
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 (OpenSSL cipher list format).
Sourcepub fn tls_ciphersuites(self, suites: impl Into<String>) -> Self
pub fn tls_ciphersuites(self, suites: impl Into<String>) -> Self
Set the allowed TLS 1.3 ciphersuites (colon-separated).
Sourcepub fn tls_protocols(self, protocols: impl Into<String>) -> Self
pub fn tls_protocols(self, protocols: impl Into<String>) -> Self
Set the allowed TLS protocol versions (e.g. "TLSv1.2 TLSv1.3").
Sourcepub fn tls_prefer_server_ciphers(self, prefer: bool) -> Self
pub fn tls_prefer_server_ciphers(self, prefer: bool) -> Self
Prefer the server’s cipher order over the client’s.
Sourcepub fn tls_session_caching(self, enable: bool) -> Self
pub fn tls_session_caching(self, enable: bool) -> Self
Enable or disable TLS session caching.
Sourcepub fn tls_session_cache_size(self, size: u32) -> Self
pub fn tls_session_cache_size(self, size: u32) -> Self
Set the number of entries in the TLS session cache.
Sourcepub fn tls_session_cache_timeout(self, seconds: u32) -> Self
pub fn tls_session_cache_timeout(self, seconds: u32) -> Self
Set the timeout in seconds for cached TLS sessions.
Sourcepub fn tls_replication(self, enable: bool) -> Self
pub fn tls_replication(self, enable: bool) -> Self
Enable TLS for replication traffic.
Sourcepub fn tls_cluster(self, enable: bool) -> Self
pub fn tls_cluster(self, enable: bool) -> Self
Enable TLS for cluster bus communication.
Sourcepub fn loglevel(self, level: LogLevel) -> Self
pub fn loglevel(self, level: LogLevel) -> Self
Set the log level (default: LogLevel::Notice).
Sourcepub fn logfile(self, path: impl Into<String>) -> Self
pub fn logfile(self, path: impl Into<String>) -> Self
Set the log file path. Defaults to redis.log inside the node directory.
Sourcepub fn maxmemory(self, limit: impl Into<String>) -> Self
pub fn maxmemory(self, limit: impl Into<String>) -> Self
Set the maximum memory limit (e.g. "256mb", "1gb").
Sourcepub fn maxmemory_policy(self, policy: impl Into<String>) -> Self
pub fn maxmemory_policy(self, policy: impl Into<String>) -> Self
Set the eviction policy when maxmemory is reached.
Sourcepub fn maxmemory_samples(self, n: u32) -> Self
pub fn maxmemory_samples(self, n: u32) -> Self
Set the number of keys sampled per eviction round (Redis default: 5).
Sourcepub fn maxmemory_clients(self, limit: impl Into<String>) -> Self
pub fn maxmemory_clients(self, limit: impl Into<String>) -> Self
Set per-client memory limit (e.g. "0" to disable).
Sourcepub fn maxmemory_eviction_tenacity(self, tenacity: u32) -> Self
pub fn maxmemory_eviction_tenacity(self, tenacity: u32) -> Self
Set eviction processing effort (1-100, Redis default: 10).
Sourcepub fn maxclients(self, n: u32) -> Self
pub fn maxclients(self, n: u32) -> Self
Set the maximum number of simultaneous client connections.
Sourcepub fn lfu_log_factor(self, factor: u32) -> Self
pub fn lfu_log_factor(self, factor: u32) -> Self
Set the logarithmic factor for the LFU frequency counter (Redis default: 10).
Sourcepub fn lfu_decay_time(self, minutes: u32) -> Self
pub fn lfu_decay_time(self, minutes: u32) -> Self
Set the LFU counter decay time in minutes (Redis default: 1).
Sourcepub fn active_expire_effort(self, effort: u32) -> Self
pub fn active_expire_effort(self, effort: u32) -> Self
Set the effort spent on active key expiration (1-100, Redis default: 10).
Sourcepub fn lazyfree_lazy_eviction(self, enable: bool) -> Self
pub fn lazyfree_lazy_eviction(self, enable: bool) -> Self
Enable or disable background deletion during eviction.
Sourcepub fn lazyfree_lazy_expire(self, enable: bool) -> Self
pub fn lazyfree_lazy_expire(self, enable: bool) -> Self
Enable or disable background deletion of expired keys.
Sourcepub fn lazyfree_lazy_server_del(self, enable: bool) -> Self
pub fn lazyfree_lazy_server_del(self, enable: bool) -> Self
Enable or disable background deletion for implicit DEL (e.g. RENAME).
Sourcepub fn lazyfree_lazy_user_del(self, enable: bool) -> Self
pub fn lazyfree_lazy_user_del(self, enable: bool) -> Self
Make explicit DEL behave like UNLINK (background deletion).
Sourcepub fn lazyfree_lazy_user_flush(self, enable: bool) -> Self
pub fn lazyfree_lazy_user_flush(self, enable: bool) -> Self
Make FLUSHDB/FLUSHALL default to ASYNC.
Sourcepub fn save(self, save: bool) -> Self
pub fn save(self, save: bool) -> Self
Enable or disable RDB snapshots (default: off).
true omits the save directive (Redis built-in defaults apply).
false emits save "" to disable RDB entirely.
Sourcepub fn save_schedule(self, schedule: Vec<(u64, u64)>) -> Self
pub fn save_schedule(self, schedule: Vec<(u64, u64)>) -> Self
Set a custom RDB save schedule.
Each (seconds, changes) pair emits a save <seconds> <changes> line.
Sourcepub fn appendonly(self, appendonly: bool) -> Self
pub fn appendonly(self, appendonly: bool) -> Self
Enable or disable AOF persistence.
Sourcepub fn appendfsync(self, policy: AppendFsync) -> Self
pub fn appendfsync(self, policy: AppendFsync) -> Self
Set the AOF fsync policy.
Sourcepub fn appendfilename(self, name: impl Into<String>) -> Self
pub fn appendfilename(self, name: impl Into<String>) -> Self
Set the AOF filename.
Sourcepub fn appenddirname(self, name: impl Into<PathBuf>) -> Self
pub fn appenddirname(self, name: impl Into<PathBuf>) -> Self
Set the AOF directory name.
Sourcepub fn aof_use_rdb_preamble(self, enable: bool) -> Self
pub fn aof_use_rdb_preamble(self, enable: bool) -> Self
Enable or disable the RDB preamble in AOF files.
Sourcepub fn aof_load_truncated(self, enable: bool) -> Self
pub fn aof_load_truncated(self, enable: bool) -> Self
Control whether truncated AOF files are loaded.
Sourcepub fn aof_load_corrupt_tail_max_size(self, size: impl Into<String>) -> Self
pub fn aof_load_corrupt_tail_max_size(self, size: impl Into<String>) -> Self
Set the maximum allowed size of a corrupt AOF tail (e.g. "32mb").
Sourcepub fn aof_rewrite_incremental_fsync(self, enable: bool) -> Self
pub fn aof_rewrite_incremental_fsync(self, enable: bool) -> Self
Enable or disable incremental fsync during AOF rewrites.
Sourcepub fn aof_timestamp_enabled(self, enable: bool) -> Self
pub fn aof_timestamp_enabled(self, enable: bool) -> Self
Enable or disable timestamps in the AOF file.
Sourcepub fn auto_aof_rewrite_percentage(self, pct: u32) -> Self
pub fn auto_aof_rewrite_percentage(self, pct: u32) -> Self
Set the percentage growth that triggers an automatic AOF rewrite.
Sourcepub fn auto_aof_rewrite_min_size(self, size: impl Into<String>) -> Self
pub fn auto_aof_rewrite_min_size(self, size: impl Into<String>) -> Self
Set the minimum AOF size before an automatic rewrite is triggered (e.g. "64mb").
Sourcepub fn no_appendfsync_on_rewrite(self, enable: bool) -> Self
pub fn no_appendfsync_on_rewrite(self, enable: bool) -> Self
Control whether fsync is suppressed during AOF rewrites.
Sourcepub fn replicaof(self, host: impl Into<String>, port: u16) -> Self
pub fn replicaof(self, host: impl Into<String>, port: u16) -> Self
Configure this server as a replica of the given master.
Sourcepub fn masterauth(self, password: impl Into<String>) -> Self
pub fn masterauth(self, password: impl Into<String>) -> Self
Set the password for authenticating with a master.
Sourcepub fn masteruser(self, user: impl Into<String>) -> Self
pub fn masteruser(self, user: impl Into<String>) -> Self
Set the username for authenticating with a master (ACL-based auth).
Sourcepub fn repl_backlog_size(self, size: impl Into<String>) -> Self
pub fn repl_backlog_size(self, size: impl Into<String>) -> Self
Set the replication backlog size (e.g. "1mb").
Sourcepub fn repl_backlog_ttl(self, seconds: u32) -> Self
pub fn repl_backlog_ttl(self, seconds: u32) -> Self
Set seconds before the backlog is freed when no replicas are connected.
Sourcepub fn repl_disable_tcp_nodelay(self, disable: bool) -> Self
pub fn repl_disable_tcp_nodelay(self, disable: bool) -> Self
Disable TCP_NODELAY on the replication socket.
Sourcepub fn repl_diskless_load(self, policy: ReplDisklessLoad) -> Self
pub fn repl_diskless_load(self, policy: ReplDisklessLoad) -> Self
Set the diskless load policy for replicas.
Sourcepub fn repl_diskless_sync(self, enable: bool) -> Self
pub fn repl_diskless_sync(self, enable: bool) -> Self
Enable or disable diskless sync from master to replicas.
Sourcepub fn repl_diskless_sync_delay(self, seconds: u32) -> Self
pub fn repl_diskless_sync_delay(self, seconds: u32) -> Self
Set the delay in seconds before starting a diskless sync.
Sourcepub fn repl_diskless_sync_max_replicas(self, n: u32) -> Self
pub fn repl_diskless_sync_max_replicas(self, n: u32) -> Self
Set the maximum number of replicas to wait for before starting a diskless sync.
Sourcepub fn repl_ping_replica_period(self, seconds: u32) -> Self
pub fn repl_ping_replica_period(self, seconds: u32) -> Self
Set the interval in seconds between PING commands sent to the master.
Sourcepub fn repl_timeout(self, seconds: u32) -> Self
pub fn repl_timeout(self, seconds: u32) -> Self
Set the replication timeout in seconds.
Sourcepub fn replica_announce_ip(self, ip: impl Into<String>) -> Self
pub fn replica_announce_ip(self, ip: impl Into<String>) -> Self
Set the IP address a replica announces to the master.
Sourcepub fn replica_announce_port(self, port: u16) -> Self
pub fn replica_announce_port(self, port: u16) -> Self
Set the port a replica announces to the master.
Sourcepub fn replica_announced(self, announced: bool) -> Self
pub fn replica_announced(self, announced: bool) -> Self
Control whether the replica is announced to clients.
Sourcepub fn replica_full_sync_buffer_limit(self, size: impl Into<String>) -> Self
pub fn replica_full_sync_buffer_limit(self, size: impl Into<String>) -> Self
Set the buffer limit for full synchronization on replicas (e.g. "256mb").
Sourcepub fn replica_ignore_disk_write_errors(self, ignore: bool) -> Self
pub fn replica_ignore_disk_write_errors(self, ignore: bool) -> Self
Control whether replicas ignore disk-write errors.
Sourcepub fn replica_ignore_maxmemory(self, ignore: bool) -> Self
pub fn replica_ignore_maxmemory(self, ignore: bool) -> Self
Control whether replicas ignore the maxmemory setting.
Sourcepub fn replica_lazy_flush(self, enable: bool) -> Self
pub fn replica_lazy_flush(self, enable: bool) -> Self
Enable or disable lazy flush on replicas during full sync.
Sourcepub fn replica_priority(self, priority: u32) -> Self
pub fn replica_priority(self, priority: u32) -> Self
Set the replica priority for Sentinel promotion.
Sourcepub fn replica_read_only(self, read_only: bool) -> Self
pub fn replica_read_only(self, read_only: bool) -> Self
Control whether the replica is read-only.
Sourcepub fn replica_serve_stale_data(self, serve: bool) -> Self
pub fn replica_serve_stale_data(self, serve: bool) -> Self
Control whether the replica serves stale data while syncing.
Sourcepub fn min_replicas_to_write(self, n: u32) -> Self
pub fn min_replicas_to_write(self, n: u32) -> Self
Set the minimum number of replicas that must acknowledge writes.
Sourcepub fn min_replicas_max_lag(self, seconds: u32) -> Self
pub fn min_replicas_max_lag(self, seconds: u32) -> Self
Set the maximum replication lag (in seconds) for a replica to count toward min-replicas-to-write.
Sourcepub fn password(self, password: impl Into<String>) -> Self
pub fn password(self, password: impl Into<String>) -> Self
Set a requirepass password for client connections.
Sourcepub fn cluster_enabled(self, enabled: bool) -> Self
pub fn cluster_enabled(self, enabled: bool) -> Self
Enable Redis Cluster mode.
Sourcepub fn cluster_node_timeout(self, ms: u64) -> Self
pub fn cluster_node_timeout(self, ms: u64) -> Self
Set the cluster node timeout in milliseconds.
Sourcepub fn cluster_config_file(self, path: impl Into<PathBuf>) -> Self
pub fn cluster_config_file(self, path: impl Into<PathBuf>) -> Self
Set a custom cluster config file path (overrides auto-generated default).
Sourcepub fn cluster_require_full_coverage(self, require: bool) -> Self
pub fn cluster_require_full_coverage(self, require: bool) -> Self
Require full hash slot coverage for the cluster to accept writes.
Sourcepub fn cluster_allow_reads_when_down(self, allow: bool) -> Self
pub fn cluster_allow_reads_when_down(self, allow: bool) -> Self
Allow reads when the cluster is down.
Sourcepub fn cluster_allow_pubsubshard_when_down(self, allow: bool) -> Self
pub fn cluster_allow_pubsubshard_when_down(self, allow: bool) -> Self
Allow pubsub shard channels when the cluster is down.
Sourcepub fn cluster_allow_replica_migration(self, allow: bool) -> Self
pub fn cluster_allow_replica_migration(self, allow: bool) -> Self
Allow automatic replica migration between masters.
Sourcepub fn cluster_migration_barrier(self, barrier: u32) -> Self
pub fn cluster_migration_barrier(self, barrier: u32) -> Self
Set the minimum number of replicas a master must retain before one can migrate.
Sourcepub fn cluster_replica_no_failover(self, no_failover: bool) -> Self
pub fn cluster_replica_no_failover(self, no_failover: bool) -> Self
Prevent this replica from ever attempting a failover.
Sourcepub fn cluster_replica_validity_factor(self, factor: u32) -> Self
pub fn cluster_replica_validity_factor(self, factor: u32) -> Self
Set the replica validity factor (multiplied by node timeout).
Sourcepub fn cluster_announce_ip(self, ip: impl Into<String>) -> Self
pub fn cluster_announce_ip(self, ip: impl Into<String>) -> Self
Set the IP address this node announces to the cluster bus.
Sourcepub fn cluster_announce_port(self, port: u16) -> Self
pub fn cluster_announce_port(self, port: u16) -> Self
Set the client port this node announces to the cluster.
Sourcepub fn cluster_announce_bus_port(self, port: u16) -> Self
pub fn cluster_announce_bus_port(self, port: u16) -> Self
Set the cluster bus port this node announces.
Sourcepub fn cluster_announce_tls_port(self, port: u16) -> Self
pub fn cluster_announce_tls_port(self, port: u16) -> Self
Set the TLS port this node announces to the cluster.
Sourcepub fn cluster_announce_hostname(self, hostname: impl Into<String>) -> Self
pub fn cluster_announce_hostname(self, hostname: impl Into<String>) -> Self
Set the hostname this node announces to the cluster.
Sourcepub fn cluster_announce_human_nodename(self, name: impl Into<String>) -> Self
pub fn cluster_announce_human_nodename(self, name: impl Into<String>) -> Self
Set the human-readable node name announced to the cluster.
Sourcepub fn cluster_port(self, port: u16) -> Self
pub fn cluster_port(self, port: u16) -> Self
Set the dedicated cluster bus port (0 = auto with +10000 offset).
Sourcepub fn cluster_preferred_endpoint_type(
self,
endpoint_type: impl Into<String>,
) -> Self
pub fn cluster_preferred_endpoint_type( self, endpoint_type: impl Into<String>, ) -> Self
Set the preferred endpoint type for cluster redirections (e.g. "ip", "hostname").
Sourcepub fn cluster_link_sendbuf_limit(self, limit: u64) -> Self
pub fn cluster_link_sendbuf_limit(self, limit: u64) -> Self
Set the send buffer limit in bytes for cluster bus links.
Sourcepub fn cluster_compatibility_sample_ratio(self, ratio: u32) -> Self
pub fn cluster_compatibility_sample_ratio(self, ratio: u32) -> Self
Set the compatibility sample ratio percentage.
Sourcepub fn cluster_slot_migration_handoff_max_lag_bytes(self, bytes: u64) -> Self
pub fn cluster_slot_migration_handoff_max_lag_bytes(self, bytes: u64) -> Self
Set the maximum lag in bytes before slot migration handoff.
Sourcepub fn cluster_slot_migration_write_pause_timeout(self, ms: u64) -> Self
pub fn cluster_slot_migration_write_pause_timeout(self, ms: u64) -> Self
Set the write pause timeout in milliseconds during slot migration.
Sourcepub fn cluster_slot_stats_enabled(self, enable: bool) -> Self
pub fn cluster_slot_stats_enabled(self, enable: bool) -> Self
Enable per-slot statistics collection.
Sourcepub fn hash_max_listpack_entries(self, n: u32) -> Self
pub fn hash_max_listpack_entries(self, n: u32) -> Self
Set the maximum number of entries in a hash before converting from listpack to hash table.
Sourcepub fn hash_max_listpack_value(self, n: u32) -> Self
pub fn hash_max_listpack_value(self, n: u32) -> Self
Set the maximum size of a hash entry value before converting from listpack to hash table.
Sourcepub fn list_max_listpack_size(self, n: i32) -> Self
pub fn list_max_listpack_size(self, n: i32) -> Self
Set the maximum listpack size for list entries.
Positive values limit the number of elements per listpack node. Negative values set a byte-size limit: -1 = 4KB, -2 = 8KB, -3 = 16KB, -4 = 32KB, -5 = 64KB.
Sourcepub fn list_compress_depth(self, n: u32) -> Self
pub fn list_compress_depth(self, n: u32) -> Self
Set the number of quicklist nodes at each end of the list that are not compressed.
0 disables compression. 1 means the head and tail are uncompressed, etc.
Sourcepub fn set_max_intset_entries(self, n: u32) -> Self
pub fn set_max_intset_entries(self, n: u32) -> Self
Set the maximum number of integer entries in a set before converting from intset to hash table.
Sourcepub fn set_max_listpack_entries(self, n: u32) -> Self
pub fn set_max_listpack_entries(self, n: u32) -> Self
Set the maximum number of entries in a set before converting from listpack to hash table.
Sourcepub fn set_max_listpack_value(self, n: u32) -> Self
pub fn set_max_listpack_value(self, n: u32) -> Self
Set the maximum size of a set entry value before converting from listpack to hash table.
Sourcepub fn zset_max_listpack_entries(self, n: u32) -> Self
pub fn zset_max_listpack_entries(self, n: u32) -> Self
Set the maximum number of entries in a sorted set before converting from listpack to skiplist.
Sourcepub fn zset_max_listpack_value(self, n: u32) -> Self
pub fn zset_max_listpack_value(self, n: u32) -> Self
Set the maximum size of a sorted set entry value before converting from listpack to skiplist.
Sourcepub fn hll_sparse_max_bytes(self, n: u32) -> Self
pub fn hll_sparse_max_bytes(self, n: u32) -> Self
Set the maximum number of bytes for the sparse representation of a HyperLogLog.
Sourcepub fn stream_node_max_bytes(self, n: u32) -> Self
pub fn stream_node_max_bytes(self, n: u32) -> Self
Set the maximum number of bytes in a single stream listpack node.
Sourcepub fn stream_node_max_entries(self, n: u32) -> Self
pub fn stream_node_max_entries(self, n: u32) -> Self
Set the maximum number of entries in a single stream listpack node.
Sourcepub fn stream_idmp_duration(self, ms: u64) -> Self
pub fn stream_idmp_duration(self, ms: u64) -> Self
Set the duration in milliseconds for stream ID de-duplication.
Sourcepub fn stream_idmp_maxsize(self, n: u64) -> Self
pub fn stream_idmp_maxsize(self, n: u64) -> Self
Set the maximum number of entries tracked for stream ID de-duplication.
Sourcepub fn loadmodule(self, path: impl Into<PathBuf>) -> Self
pub fn loadmodule(self, path: impl Into<PathBuf>) -> Self
Load a Redis module at startup.
Sourcepub fn io_threads(self, n: u32) -> Self
pub fn io_threads(self, n: u32) -> Self
Set the number of I/O threads.
Sourcepub fn io_threads_do_reads(self, enable: bool) -> Self
pub fn io_threads_do_reads(self, enable: bool) -> Self
Enable I/O threads for reads as well as writes.
Sourcepub fn notify_keyspace_events(self, events: impl Into<String>) -> Self
pub fn notify_keyspace_events(self, events: impl Into<String>) -> Self
Set keyspace notification events (e.g. "KEA").
Sourcepub fn slowlog_log_slower_than(self, us: i64) -> Self
pub fn slowlog_log_slower_than(self, us: i64) -> Self
Set the slow log threshold in microseconds (0 = log everything, -1 = disabled).
Sourcepub fn slowlog_max_len(self, n: u32) -> Self
pub fn slowlog_max_len(self, n: u32) -> Self
Set the maximum number of slow log entries.
Sourcepub fn latency_monitor_threshold(self, ms: u64) -> Self
pub fn latency_monitor_threshold(self, ms: u64) -> Self
Set the latency monitor threshold in milliseconds (0 = disabled).
Sourcepub fn latency_tracking(self, enable: bool) -> Self
pub fn latency_tracking(self, enable: bool) -> Self
Enable or disable the extended latency tracking system.
Sourcepub fn latency_tracking_info_percentiles(
self,
percentiles: impl Into<String>,
) -> Self
pub fn latency_tracking_info_percentiles( self, percentiles: impl Into<String>, ) -> Self
Set percentiles reported by the latency tracking system (e.g. "50 99 99.9").
Sourcepub fn activedefrag(self, enable: bool) -> Self
pub fn activedefrag(self, enable: bool) -> Self
Enable or disable active defragmentation.
Sourcepub fn active_defrag_ignore_bytes(self, bytes: impl Into<String>) -> Self
pub fn active_defrag_ignore_bytes(self, bytes: impl Into<String>) -> Self
Set the minimum fragmentation waste to start defragmentation (e.g. "100mb").
Sourcepub fn active_defrag_threshold_lower(self, pct: u32) -> Self
pub fn active_defrag_threshold_lower(self, pct: u32) -> Self
Set the minimum fragmentation percentage to start defragmentation.
Sourcepub fn active_defrag_threshold_upper(self, pct: u32) -> Self
pub fn active_defrag_threshold_upper(self, pct: u32) -> Self
Set the fragmentation percentage at which maximum effort is used.
Sourcepub fn active_defrag_cycle_min(self, pct: u32) -> Self
pub fn active_defrag_cycle_min(self, pct: u32) -> Self
Set the minimal CPU effort for defragmentation (percentage).
Sourcepub fn active_defrag_cycle_max(self, pct: u32) -> Self
pub fn active_defrag_cycle_max(self, pct: u32) -> Self
Set the maximum CPU effort for defragmentation (percentage).
Sourcepub fn active_defrag_max_scan_fields(self, n: u32) -> Self
pub fn active_defrag_max_scan_fields(self, n: u32) -> Self
Set the maximum fields processed per defrag scan step.
Sourcepub fn syslog_enabled(self, enable: bool) -> Self
pub fn syslog_enabled(self, enable: bool) -> Self
Enable logging to syslog.
Sourcepub fn syslog_ident(self, ident: impl Into<String>) -> Self
pub fn syslog_ident(self, ident: impl Into<String>) -> Self
Set the syslog identity string.
Sourcepub fn syslog_facility(self, facility: impl Into<String>) -> Self
pub fn syslog_facility(self, facility: impl Into<String>) -> Self
Set the syslog facility (e.g. "local0").
Sourcepub fn supervised(self, mode: impl Into<String>) -> Self
pub fn supervised(self, mode: impl Into<String>) -> Self
Set the supervision mode ("upstart", "systemd", "auto", or "no").
Sourcepub fn always_show_logo(self, enable: bool) -> Self
pub fn always_show_logo(self, enable: bool) -> Self
Show the Redis logo on startup.
Sourcepub fn set_proc_title(self, enable: bool) -> Self
pub fn set_proc_title(self, enable: bool) -> Self
Enable setting the process title.
Sourcepub fn proc_title_template(self, template: impl Into<String>) -> Self
pub fn proc_title_template(self, template: impl Into<String>) -> Self
Set the process title template.
Sourcepub fn acl_pubsub_default(self, default: impl Into<String>) -> Self
pub fn acl_pubsub_default(self, default: impl Into<String>) -> Self
Set the default pub/sub ACL permissions ("allchannels" or "resetchannels").
Sourcepub fn acllog_max_len(self, n: u32) -> Self
pub fn acllog_max_len(self, n: u32) -> Self
Set the maximum length of the ACL log.
Sourcepub fn enable_debug_command(self, mode: impl Into<String>) -> Self
pub fn enable_debug_command(self, mode: impl Into<String>) -> Self
Enable the DEBUG command ("yes", "local", or "no").
Sourcepub fn enable_module_command(self, mode: impl Into<String>) -> Self
pub fn enable_module_command(self, mode: impl Into<String>) -> Self
Enable the MODULE command ("yes", "local", or "no").
Sourcepub fn enable_protected_configs(self, mode: impl Into<String>) -> Self
pub fn enable_protected_configs(self, mode: impl Into<String>) -> Self
Allow CONFIG SET to modify protected configs ("yes", "local", or "no").
Sourcepub fn rename_command(
self,
command: impl Into<String>,
new_name: impl Into<String>,
) -> Self
pub fn rename_command( self, command: impl Into<String>, new_name: impl Into<String>, ) -> Self
Rename a command. Pass an empty new name to disable the command entirely.
Sourcepub fn sanitize_dump_payload(self, mode: impl Into<String>) -> Self
pub fn sanitize_dump_payload(self, mode: impl Into<String>) -> Self
Set dump payload sanitization mode ("yes", "no", or "clients").
Sourcepub fn hide_user_data_from_log(self, enable: bool) -> Self
pub fn hide_user_data_from_log(self, enable: bool) -> Self
Hide user data from log messages.
Sourcepub fn bind_source_addr(self, addr: impl Into<String>) -> Self
pub fn bind_source_addr(self, addr: impl Into<String>) -> Self
Set the source address for outgoing connections.
Sourcepub fn busy_reply_threshold(self, ms: u64) -> Self
pub fn busy_reply_threshold(self, ms: u64) -> Self
Set the busy reply threshold in milliseconds.
Sourcepub fn client_output_buffer_limit(self, limit: impl Into<String>) -> Self
pub fn client_output_buffer_limit(self, limit: impl Into<String>) -> Self
Add a client output buffer limit (e.g. "normal 0 0 0" or "replica 256mb 64mb 60").
Sourcepub fn client_query_buffer_limit(self, limit: impl Into<String>) -> Self
pub fn client_query_buffer_limit(self, limit: impl Into<String>) -> Self
Set the maximum size of a single client query buffer.
Sourcepub fn proto_max_bulk_len(self, len: impl Into<String>) -> Self
pub fn proto_max_bulk_len(self, len: impl Into<String>) -> Self
Set the maximum size of a single protocol bulk request.
Sourcepub fn max_new_connections_per_cycle(self, n: u32) -> Self
pub fn max_new_connections_per_cycle(self, n: u32) -> Self
Set the maximum number of new connections per event loop cycle.
Sourcepub fn max_new_tls_connections_per_cycle(self, n: u32) -> Self
pub fn max_new_tls_connections_per_cycle(self, n: u32) -> Self
Set the maximum number of new TLS connections per event loop cycle.
Sourcepub fn socket_mark_id(self, id: u32) -> Self
pub fn socket_mark_id(self, id: u32) -> Self
Set the socket mark ID for outgoing connections.
Sourcepub fn dbfilename(self, name: impl Into<String>) -> Self
pub fn dbfilename(self, name: impl Into<String>) -> Self
Set the RDB dump filename.
Sourcepub fn rdbcompression(self, enable: bool) -> Self
pub fn rdbcompression(self, enable: bool) -> Self
Enable or disable RDB compression.
Sourcepub fn rdbchecksum(self, enable: bool) -> Self
pub fn rdbchecksum(self, enable: bool) -> Self
Enable or disable RDB checksum.
Sourcepub fn rdb_save_incremental_fsync(self, enable: bool) -> Self
pub fn rdb_save_incremental_fsync(self, enable: bool) -> Self
Enable incremental fsync during RDB save.
Sourcepub fn rdb_del_sync_files(self, enable: bool) -> Self
pub fn rdb_del_sync_files(self, enable: bool) -> Self
Delete RDB sync files used by diskless replication.
Sourcepub fn stop_writes_on_bgsave_error(self, enable: bool) -> Self
pub fn stop_writes_on_bgsave_error(self, enable: bool) -> Self
Stop accepting writes when bgsave fails.
Sourcepub fn shutdown_on_sigint(self, behavior: impl Into<String>) -> Self
pub fn shutdown_on_sigint(self, behavior: impl Into<String>) -> Self
Set shutdown behavior on SIGINT (e.g. "default", "save", "nosave").
Sourcepub fn shutdown_on_sigterm(self, behavior: impl Into<String>) -> Self
pub fn shutdown_on_sigterm(self, behavior: impl Into<String>) -> Self
Set shutdown behavior on SIGTERM.
Sourcepub fn shutdown_timeout(self, seconds: u32) -> Self
pub fn shutdown_timeout(self, seconds: u32) -> Self
Set the maximum seconds to wait during shutdown for lagging replicas.
Sourcepub fn activerehashing(self, enable: bool) -> Self
pub fn activerehashing(self, enable: bool) -> Self
Enable or disable active rehashing.
Sourcepub fn crash_log_enabled(self, enable: bool) -> Self
pub fn crash_log_enabled(self, enable: bool) -> Self
Enable crash log on crash.
Sourcepub fn crash_memcheck_enabled(self, enable: bool) -> Self
pub fn crash_memcheck_enabled(self, enable: bool) -> Self
Enable crash memory check on crash.
Sourcepub fn disable_thp(self, enable: bool) -> Self
pub fn disable_thp(self, enable: bool) -> Self
Disable transparent huge pages.
Sourcepub fn dynamic_hz(self, enable: bool) -> Self
pub fn dynamic_hz(self, enable: bool) -> Self
Enable dynamic Hz adjustment.
Sourcepub fn ignore_warnings(self, warning: impl Into<String>) -> Self
pub fn ignore_warnings(self, warning: impl Into<String>) -> Self
Ignore specific warnings (e.g. "ARM64-COW-BUG").
Sourcepub fn jemalloc_bg_thread(self, enable: bool) -> Self
pub fn jemalloc_bg_thread(self, enable: bool) -> Self
Enable or disable jemalloc background thread.
Sourcepub fn locale_collate(self, locale: impl Into<String>) -> Self
pub fn locale_collate(self, locale: impl Into<String>) -> Self
Set the locale collation setting.
Sourcepub fn lua_time_limit(self, ms: u64) -> Self
pub fn lua_time_limit(self, ms: u64) -> Self
Set the Lua script time limit in milliseconds.
Sourcepub fn oom_score_adj(self, mode: impl Into<String>) -> Self
pub fn oom_score_adj(self, mode: impl Into<String>) -> Self
Set the OOM score adjustment mode ("yes", "no", or "absolute").
Sourcepub fn oom_score_adj_values(self, values: impl Into<String>) -> Self
pub fn oom_score_adj_values(self, values: impl Into<String>) -> Self
Set the OOM score adjustment values (e.g. "0 200 800").
Sourcepub fn propagation_error_behavior(self, behavior: impl Into<String>) -> Self
pub fn propagation_error_behavior(self, behavior: impl Into<String>) -> Self
Set the propagation error behavior ("panic" or "ignore").
Sourcepub fn tracking_table_max_keys(self, n: u64) -> Self
pub fn tracking_table_max_keys(self, n: u64) -> Self
Set the maximum number of keys in the tracking table.
Sourcepub fn redis_server_bin(self, bin: impl Into<String>) -> Self
pub fn redis_server_bin(self, bin: impl Into<String>) -> Self
Set a custom redis-server binary path.
Sourcepub fn redis_cli_bin(self, bin: impl Into<String>) -> Self
pub fn redis_cli_bin(self, bin: impl Into<String>) -> Self
Set a custom redis-cli binary path.
Sourcepub fn extra(self, key: impl Into<String>, value: impl Into<String>) -> Self
pub fn extra(self, key: impl Into<String>, value: impl Into<String>) -> Self
Set an arbitrary config directive not covered by dedicated methods.
Sourcepub async fn start(self) -> Result<RedisServerHandle>
pub async fn start(self) -> Result<RedisServerHandle>
Start the server. Returns a handle that stops the server on Drop.
Verifies that redis-server and redis-cli binaries are available
before attempting to launch anything.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for RedisServer
impl RefUnwindSafe for RedisServer
impl Send for RedisServer
impl Sync for RedisServer
impl Unpin for RedisServer
impl UnsafeUnpin for RedisServer
impl UnwindSafe for RedisServer
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> 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