ExWapp.Session.DeviceCache (ExWapp v0.1.2)

Copy Markdown View Source

Persists recently observed multi-device fanout targets.

Live USync remains the primary source of truth. The cache is used only as a fallback when a transient USync response is incomplete. Cached-only targets should be treated as soft candidates by callers.

Summary

Functions

evict_devices(store, target_jids)

@spec evict_devices(term(), [term()]) :: :ok

invalidate_bases(store, base_jids)

@spec invalidate_bases(term(), [term()]) :: :ok

Invalidates complete cached device lists for one or more identities.

Device notifications carry deltas, not authoritative lists. Removing the whole PN/LID-related cache entry ensures that the next send performs USync instead of treating a partial notification as the current fanout set.

persist_observed_device(store, jid)

@spec persist_observed_device(term(), term()) :: :ok

persist_usync_map(store, device_map)

@spec persist_usync_map(term(), map()) :: :ok

resolve_recent_devices(store, base_jid, runtime_cfg)

@spec resolve_recent_devices(term(), term(), map()) :: [String.t()]