diff options
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 |