diff options
author | Hubert Chathi <hubert@uhoreg.ca> | 2019-10-15 19:06:47 +0200 |
---|---|---|
committer | Hubert Chathi <hubert@uhoreg.ca> | 2019-10-15 19:06:47 +0200 |
commit | 5597723489f0a74dbc34d8fde733a7274defcc01 (patch) | |
tree | 365444a8350c669dbde549f4f211e4b839fc164f /lib/polyjuice/client/storage/ets.ex | |
parent | add another tutorial (diff) |
mix format
Diffstat (limited to 'lib/polyjuice/client/storage/ets.ex')
-rw-r--r-- | lib/polyjuice/client/storage/ets.ex | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/polyjuice/client/storage/ets.ex b/lib/polyjuice/client/storage/ets.ex index 06f7835..3332406 100644 --- a/lib/polyjuice/client/storage/ets.ex +++ b/lib/polyjuice/client/storage/ets.ex @@ -62,11 +62,13 @@ defmodule Polyjuice.Client.Storage.Ets do end end - def kv_put(%{table: table}, namespace, key, value) when is_binary(namespace) and is_binary(key) do + def kv_put(%{table: table}, namespace, key, value) + when is_binary(namespace) and is_binary(key) do :ets.insert(table, {{"kv", namespace, key}, value}) end - def kv_get(%{table: table}, namespace, key, default \\ nil) when is_binary(namespace) and is_binary(key) do + def kv_get(%{table: table}, namespace, key, default \\ nil) + when is_binary(namespace) and is_binary(key) do case :ets.lookup(table, {"kv", namespace, key}) do [{_, value}] -> value _ -> default |