To make sure the old map State
with value is no longer live you might want to do
handle_cast(compute, State) ->
FreshState = maps:remove(key, State),
tail_call(FreshState).
tail_call(FreshState) ->
erlang:garbage_collect(),
{noreply, maps:put(key, compute(), FreshState)};