Current section

Files

Jump to
harness_ff_erlang_server_sdk src cfclient_ets.erl
Raw

src/cfclient_ets.erl

%% @doc
%% Functions to make it easier to mock ETS
%% @end
-module(cfclient_ets).
-export([lookup/2, get/2]).
% Used to support mocking
-spec lookup(atom(), term()) -> list().
lookup(Table, Key) -> ets:lookup(Table, Key).
% Return values the same way as lru:get
-spec get(atom(), binary()) -> term().
get(Table, Key) ->
case ets:lookup(Table, Key) of
[] -> undefined;
[{Key, Value}] -> Value
end.