Skip to content

Commit cb99dff

Browse files
committed
Use ets:lookup_element/4 and set minimum OTP vs to 26
1 parent fa3e073 commit cb99dff

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

rebar.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{minimum_otp_vsn, "25"}.
1+
{minimum_otp_vsn, "26"}.
22

33
{erl_opts, [
44
debug_info,

src/segmented_cache_callbacks.erl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ is_member_ets_fun(EtsSegment, Key) ->
2424
-spec get_entry_ets_fun(ets:tid(), Key) -> {continue, not_found} | {stop, Value} when
2525
Key :: segmented_cache:key(), Value :: segmented_cache:value().
2626
get_entry_ets_fun(EtsSegment, Key) ->
27-
case ets:lookup(EtsSegment, Key) of
28-
[{_, Value}] -> {stop, Value};
29-
[] -> {continue, not_found}
27+
case ets:lookup_element(EtsSegment, Key, 2, '$not_found') of
28+
'$not_found' -> {continue, not_found};
29+
Value -> {stop, Value}
3030
end.
3131

3232
-spec delete_entry_fun(ets:tid(), segmented_cache:key()) -> {continue, true}.

0 commit comments

Comments
 (0)