RedisServerWrapper.Config (redis_server_wrapper v0.7.1)

Copy Markdown View Source

Redis server configuration builder.

Generates redis.conf content from a structured configuration. Supports all common Redis directives with an escape hatch via :extra for anything else.

Summary

Types

A Redis module path, optionally paired with an argument vector.

t()

Functions

Creates a new config from keyword options.

Generates redis.conf file content from the config.

Types

append_fsync()

@type append_fsync() :: :always | :everysec | :no

log_level()

@type log_level() :: :debug | :verbose | :notice | :warning

module_spec()

@type module_spec() :: String.t() | {String.t(), [String.t()]}

A Redis module path, optionally paired with an argument vector.

Plain strings preserve the original raw loadmodule directive behavior. Prefer {path, args} when arguments are needed so paths and arguments are quoted safely in the generated config.

save_policy()

@type save_policy() :: :disabled | :default | [{pos_integer(), pos_integer()}]

t()

@type t() :: %RedisServerWrapper.Config{
  appendfsync: append_fsync(),
  appendonly: boolean(),
  bind: String.t(),
  cluster_announce_bus_port: non_neg_integer() | nil,
  cluster_announce_hostname: String.t() | nil,
  cluster_announce_port: non_neg_integer() | nil,
  cluster_config_file: String.t() | nil,
  cluster_enabled: boolean(),
  cluster_node_timeout: non_neg_integer() | nil,
  daemonize: boolean(),
  dir: String.t() | nil,
  extra: [{String.t(), String.t()}],
  loadmodule: [module_spec()],
  logfile: String.t() | nil,
  loglevel: log_level(),
  masterauth: String.t() | nil,
  maxmemory: String.t() | nil,
  maxmemory_policy: String.t() | nil,
  password: String.t() | nil,
  pidfile: String.t() | nil,
  port: non_neg_integer(),
  replicaof: {String.t(), non_neg_integer()} | nil,
  save: save_policy(),
  tcp_backlog: non_neg_integer() | nil,
  tcp_keepalive: non_neg_integer() | nil,
  timeout: non_neg_integer() | nil,
  tls_auth_clients: String.t() | nil,
  tls_ca_cert_file: String.t() | nil,
  tls_cert_file: String.t() | nil,
  tls_key_file: String.t() | nil,
  tls_port: non_neg_integer() | nil,
  unixsocket: String.t() | nil,
  unixsocketperm: String.t() | nil
}

Functions

new(opts \\ [])

@spec new(keyword()) :: t()

Creates a new config from keyword options.

Config.new(port: 6400, password: "secret", appendonly: true)

Config.new(
  loadmodule: [
    {"/path/to/module.so", ["events", "expired,set", "maxlen", "10000"]}
  ]
)

to_config_string(config)

@spec to_config_string(t()) :: String.t()

Generates redis.conf file content from the config.