aboutsummaryrefslogtreecommitdiffstats
path: root/erts/preloaded/src/persistent_term.erl
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2019-02-13 08:29:51 +0100
committerBjörn Gustavsson <[email protected]>2019-02-14 06:52:26 +0100
commit0ab6149067a82d89e584f862604c1c63578fd5fa (patch)
tree32c887276074c1aa758fe655fab8219427e1e81a /erts/preloaded/src/persistent_term.erl
parent485713afa0d2481e93882bc386aebb06a49c04bc (diff)
downloadotp-0ab6149067a82d89e584f862604c1c63578fd5fa.tar.gz
otp-0ab6149067a82d89e584f862604c1c63578fd5fa.tar.bz2
otp-0ab6149067a82d89e584f862604c1c63578fd5fa.zip
Add persistent_term:get(Key, DefaultValue)
https://bugs.erlang.org/browse/ERL-843
Diffstat (limited to 'erts/preloaded/src/persistent_term.erl')
-rw-r--r--erts/preloaded/src/persistent_term.erl9
1 files changed, 8 insertions, 1 deletions
diff --git a/erts/preloaded/src/persistent_term.erl b/erts/preloaded/src/persistent_term.erl
index 5d0c266127..ee7e49b6cb 100644
--- a/erts/preloaded/src/persistent_term.erl
+++ b/erts/preloaded/src/persistent_term.erl
@@ -19,7 +19,7 @@
%%
-module(persistent_term).
--export([erase/1,get/0,get/1,info/0,put/2]).
+-export([erase/1,get/0,get/1,get/2,info/0,put/2]).
-type key() :: term().
-type value() :: term().
@@ -41,6 +41,13 @@ get() ->
get(_Key) ->
erlang:nif_error(undef).
+-spec get(Key, Default) -> Value when
+ Key :: key(),
+ Default :: value(),
+ Value :: value().
+get(_Key, _Default) ->
+ erlang:nif_error(undef).
+
-spec info() -> Info when
Info :: #{'count':=Count,'memory':=Memory},
Count :: non_neg_integer(),