Broadway v0.6.0-rc.0 Broadway.TermStorage View Source

A simple term storage to avoid passing large amounts of data between processes.

If you have a large amount of data and you want to avoid passing it between processes, you can use the TermStorage. The TermStorage creates a unique reference for it, allowing you pass the reference around instead of the term.

If the same term is put multiple times, it is stored only once, avoiding generating garbage. However, the stored terms are never removed. A common use case for this feature is in Broadway.Producer, which may need to pass a lot of information to acknowledge messages. With this module, you can store those terms when the producer starts and only pass the reference between messages:

iex> ref = Broadway.TermStorage.put({:foo, :bar, :baz}) # On init
iex> Broadway.TermStorage.get!(ref) # On ack
{:foo, :bar, :baz}

Link to this section Summary

Functions

Returns a specification to start this module under a supervisor.

Gets a previously stored term.

Puts a term.

Link to this section Functions

Returns a specification to start this module under a supervisor.

See Supervisor.

Gets a previously stored term.

Puts a term.