TuningFork.State (TuningFork v0.1.11)

Copy Markdown View Source

Values one loop leaves for another, read as they stood at the reader's own time.

set(:key, :d_minor)
get(:key, :c_major)

Summary

Functions

Forget every value.

The newest value under key written at or before the reading round's time, or default when there is none. Never blocks; outside a loop the time is 0.

Every key with a value as of the reading round's time.

Store value under key, at the time of the round doing the writing.

Functions

clear()

@spec clear() :: :ok

Forget every value.

get(key, default \\ nil)

@spec get(term(), term()) :: term()

The newest value under key written at or before the reading round's time, or default when there is none. Never blocks; outside a loop the time is 0.

iex> TuningFork.State.clear()
iex> TuningFork.State.get(:missing, :nothing)
:nothing

keys()

@spec keys() :: [term()]

Every key with a value as of the reading round's time.

set(key, value)

@spec set(term(), term()) :: term()

Store value under key, at the time of the round doing the writing.

iex> TuningFork.State.clear()
iex> TuningFork.State.set(:mood, :bright)
iex> TuningFork.State.get(:mood)
:bright