Created
November 22, 2017 03:19
-
-
Save jlerche/1b2705917e905d2cbe96df4ef74b5dab to your computer and use it in GitHub Desktop.
A naive ets store
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule Store do | |
use GenServer | |
def start_link(state \\ [:foo]) do | |
GenServer.start_link(__MODULE__, state, name: __MODULE__) | |
end | |
def init(state) do | |
:ets.new(:store, [:named_table]) | |
:ets.insert(:store, {:key, state}) | |
{:ok, state} | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment