A simple library to store and retrieve data from the process tree.
The package is available in Hex, and can be installed by
adding process_store
to your list of dependencies in mix.exs
:
def deps do
[
{:process_store, "~> 0.2.0"}
]
end
Store a value:
iex> ProcessStore.store(:my_key, "my value")
nil
# When a key already exists, store the new value and return the previous one.
iex> ProcessStore.store(:my_key, "a new value")
"my value"
Fetch a value:
iex> ProcessStore.fetch(:my_key)
"a new value"
iex> ProcessStore.store(:non_existing_key)
nil
The stored values are available in different processes:
iex> ProcessStore.store(:my_key, "my value")
nil
iex> task = Task.async(fn -> ProcessStore.fetch(:my_key) end)
%Task{
owner: #PID<0.184.0>,
pid: #PID<0.208.0>,
ref: #Reference<0.1292195905.2439512066.24239>
}
iex> Task.await(task)
"my value"
The full documentation is available at https://hexdocs.pm/process_store.
Helpful make commands are available for development, like to install dependencies and run tests.
To list all the make commands:
make
After merge a new feature/bug you can bump and publish it with:
make release
make publish
See the contributing guide.
Process Store is released under the Apache 2.0 License. See the LICENSE file.