# `Skeg.KV`

Key-value commands. Keys and values are binaries, sent and returned as is.

Every function takes `:timeout` in ms as an option. Errors are
`%Skeg.Error{}`; see it for what each kind proves about the request.

# `conn`

```elixir
@type conn() :: Skeg.conn()
```

# `error`

```elixir
@type error() :: {:error, Skeg.Error.t()}
```

# `delete`

```elixir
@spec delete(conn(), [binary(), ...], keyword()) :: {:ok, non_neg_integer()} | error()
```

Deletes `keys` and returns how many existed.

# `get`

```elixir
@spec get(conn(), binary(), keyword()) :: {:ok, binary() | nil} | error()
```

The value under `key`, or `nil` when there is none. An empty value is `""`.

# `incr`

```elixir
@spec incr(conn(), binary(), keyword()) :: {:ok, integer()} | error()
```

Adds one to the integer under `key` and returns the new value.

# `incr_by`

```elixir
@spec incr_by(conn(), binary(), integer(), keyword()) :: {:ok, integer()} | error()
```

Adds `delta` to the integer under `key` and returns the new value.

# `mget`

```elixir
@spec mget(conn(), [binary(), ...], keyword()) :: {:ok, [binary() | nil]} | error()
```

The values of `keys` in the same order, `nil` where a key is missing.

# `set`

```elixir
@spec set(conn(), binary(), binary(), keyword()) :: :ok | error()
```

Stores `value` under `key`, replacing any previous value.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
