Redis-backed CouncilEx.Registry runtime registrations. Multi-replica safe.
Stores values as :erlang.term_to_binary/1 blobs under keys
#{prefix}:#{kind}:#{name}. Decoded with binary_to_term/2 in
:safe mode — atoms (including module names) referenced in stored
values must already exist on the deserializing node. In a same-version
multi-replica deployment this is automatic: every replica loads the
same release.
Setup
Add :redix to your deps:
{:council_ex, "~> 0.12"},
{:redix, "~> 1.5"}Start a Redix connection in your supervision tree and select this
backend:
children = [
{Redix, name: :council_ex_redix, host: "localhost"}
]
config :council_ex,
:registry_backend,
CouncilEx.Registry.Redis
config :council_ex, CouncilEx.Registry.Redis,
conn: :council_ex_redix,
prefix: "council_ex:registry"Both :conn and :prefix default to :council_ex_redix and
"council_ex:registry" respectively.
Limitations
- Anonymous closures with captured environment cannot be transmitted
between nodes via
term_to_binaryreliably. Prefer remote captures (&MyApp.Mod.fun/1) for:input_mapperregistrations. - Atoms not present on the receiver crash decode. Keep registered modules in the codebase, not generated at runtime.
- Failed Redis operations return
{:error, reason}fromput/3anddelete/2;get/2returnsnilon failure (cold-start fallback).