Initial Commit

This commit is contained in:
2024-12-24 17:45:52 +01:00
commit c30845575a
42 changed files with 870 additions and 0 deletions

17
kv.exs Normal file
View File

@@ -0,0 +1,17 @@
# Key-Value store
defmodule KV do
def start_link do
Task.start_link(fn -> loop(%{}) end)
end
defp loop(map) do
receive do
{:get, key, caller} ->
send(caller, Map.get(map, key))
loop(map)
{:put, key, value} ->
loop(Map.put(map, key, value))
end
end
end