diff options
author | Björn Gustavsson <[email protected]> | 2019-02-15 09:55:33 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2019-02-15 09:55:33 +0100 |
commit | 595c159823089d0186ec2617c174356d1ff2de65 (patch) | |
tree | 5c0a7ec7cf13c699b10daf284011a7a881e69eed /erts/preloaded/src | |
parent | 741109889b96e92c2edc38f4068e27ac5cd53fb8 (diff) | |
parent | 0ab6149067a82d89e584f862604c1c63578fd5fa (diff) | |
download | otp-595c159823089d0186ec2617c174356d1ff2de65.tar.gz otp-595c159823089d0186ec2617c174356d1ff2de65.tar.bz2 otp-595c159823089d0186ec2617c174356d1ff2de65.zip |
Merge pull request #2140 from bjorng/bjorn/erts/persistent_term-default/ERL-843/OTP-15576
Add persistent_term:get(Key, DefaultValue)
Diffstat (limited to 'erts/preloaded/src')
-rw-r--r-- | erts/preloaded/src/persistent_term.erl | 9 |
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(), |