There is currently no way to quickly check if a key exists in persistent term. The closest you can get is the following function:
has_key(Key) ->
try
persistent_term:get(Key),
true
catch
error:badarg ->
false
end.
This is clunky and not performant, especially given that is such a trivial function.
Originally suggested by @josevalim and approved by @jhogberg.