Current section
Files
Jump to
Current section
Files
src/lazy_const_ffi.erl
-module(lazy_const_ffi).
-export([new/2]).
new(OuterFn, InnerFn) ->
try persistent_term:get(OuterFn)
catch error:badarg ->
Value = InnerFn(),
ok = persistent_term:put(OuterFn, Value),
Value
end.