Bandera.Notifications behaviour (bandera v0.1.0)

Copy Markdown

Cross-node cache-busting notifications.

When the Bandera.Store.TwoLevel store writes a flag, it calls publish_change/1. If notifications are enabled, the configured adapter broadcasts the change to all nodes; each node's notifier busts its local cache entry for that flag (ignoring changes it published itself). Disabled by default.

config :bandera,
  cache_bust_notifications: [
    enabled: true,
    adapter: Bandera.Notifications.Redis,
    redis: [host: "localhost", port: 6379]
  ]

Summary

Callbacks

Broadcasts a flag change to other nodes so they bust their local cache entry.

Returns this node's stable per-node id, used to ignore self-published changes.

Functions

Publish a flag change to other nodes (no-op when notifications are disabled, best-effort when enabled).

Callbacks

publish_change(flag_name)

@callback publish_change(flag_name :: atom()) :: :ok | {:error, term()}

Broadcasts a flag change to other nodes so they bust their local cache entry.

unique_id()

@callback unique_id() :: String.t()

Returns this node's stable per-node id, used to ignore self-published changes.

Functions

publish_change(flag_name)

@spec publish_change(atom()) :: :ok | {:error, term()}

Publish a flag change to other nodes (no-op when notifications are disabled, best-effort when enabled).