View Source Estructura.Lazy (estructura v1.6.1)
The field stub allowing lazy instantiation of Estructura
fields.
Summary
Functions
Apply the lazy getter to the data passed as an argument
Create the new struct with the getter passed as an argument
Validates if the value is not stale yet according to expires_in
setting
Types
@type key() :: Map.key()
@type t() :: %Estructura.Lazy{ expires_in: non_neg_integer() | :instantly | :never, timestamp: nil | DateTime.t(), payload: any(), value: cached(), getter: getter() }
@type value() :: Map.value()
Functions
Apply the lazy getter to the data passed as an argument
Examples
iex> lazy = Estructura.Lazy.new(&System.fetch_env/1)
...> Estructura.Lazy.apply(lazy, "LANG").value
System.fetch_env("LANG")
@spec new(getter(), non_neg_integer() | :instantly | :never) :: t()
Create the new struct with the getter passed as an argument
Validates if the value is not stale yet according to expires_in
setting