# GenPETS
Small wrapper around :ets Erlang/OTP library, but persists the data to a file each time the table updated. While providing the same read speed as a regular ETS.
```elixir
# Start a new GenPETS:
iex(1)> {:ok, pid} = GenPETS.start(table_name: :some_table_name, file_path: "some/file/path")
{:ok, #PID<0.140.0>}
# Control using the provided PID:
iex(2)> GenPETS.write(pid, :key, :value)
:ok
# Alternatively, you can use your table_name as well:
iex(3)> GenPETS.read(:some_table_name, :key)
[key: :value]
# With a public table, you can read and write by accessing the table directly.
# But you SHOULD NOT use direct writes unless you want to skip writing to disk:
iex(4)> GenPETS.direct_read(:some_table_name, :key)
[key: :value]
iex(5)> GenPETS.direct_write(:some_table_name, :key, :value)
[key: :value]
```
## Installation
```elixir
def deps do
[
{:gen_pets, git: "git@gitlab.com:wit_solutions/gen_pets.git"},
]
end
```