View Source ProcessHub.Service.Storage.Entry (ProcessHub v0.7.0)
The stored-entry value object shared by every registry storage backend.
An entry is a {key, value} tuple, or {key, value, expire_ms} when it
carries a TTL. These helpers build entries on write and read their value back
on read (filtering expired ones), independent of where the entry is persisted
(ETS, DETS, a future remote store, ...).
Summary
Functions
Builds the entry for key/value, attaching an ms expiry when opts carries one.
Builds entries for a batch of {key, value, opts} items (see build/3).
Returns whether an entry has passed its TTL expiry.
Current time in ms since the unix epoch, the unit every expiry is expressed in.
Returns an entry's stored value, or nil if it has expired.
Functions
Builds the entry for key/value, attaching an ms expiry when opts carries one.
Two forms are accepted, :expire_at taking precedence:
:expire_at— an absolute deadline in ms since the unix epoch. Used where the deadline is derived from a replicated field (a stopped row'sstopped_at), so every node computes the same value and re-writing the entry cannot extend its lifetime.:ttl— a duration in ms, resolved against the current time.
Builds entries for a batch of {key, value, opts} items (see build/3).
Returns whether an entry has passed its TTL expiry.
@spec now_ms() :: integer()
Current time in ms since the unix epoch, the unit every expiry is expressed in.
Returns an entry's stored value, or nil if it has expired.