I’m currently using Redis to cache some information in my application. But I saw that ETS may be faster at lookup actions (https://github.com/minhajuddin/redis_vs_ets_showdown) . With that in mind, I want to create an ETS table at my app startup, so I can use it in a Plug.
I’ve tried to the following, but it did not work.
defmodule MyApp.Validator do
@bucket :ets.new(:bucket, [:set, :protected])
def put_validation(id) do
:ets.insert_new(@bucket, {id, %{"active" => true, "user" => "test"}}
end
end
It returns argument error. I think it’s because the ETS does not exist.
How and where can I initialize an ETS in order to use it inside my application?






















