# `Cache.ConCache`
[🔗](https://github.com/mikaak/elixir_cache/blob/main/lib/cache/con_cache.ex#L1)

ETS Based cache https://github.com/sasa1977/con_cache

Takes the following options:

 * `:acquire_lock_timeout` (`t:pos_integer/0`) - The default value is `5000`.

* `:touch_on_read` (`t:boolean/0`) - The default value is `false`.

* `:global_ttl` - The default value is `1800000`.

* `:ttl_check_interval` - The default value is `60000`.

* `:dirty?` (`t:boolean/0`) - Use dirty_put instead of locking to put, enabled by default The default value is `true`.

* `:ets_options` - https://www.erlang.org/doc/man/ets.html#new-2

# `ets_option`

```elixir
@type ets_option() ::
  :named_table
  | :compressed
  | {:heir, pid()}
  | {:write_concurrency, boolean() | :auto}
  | {:read_concurrency, boolean()}
  | :ordered_set
  | :set
  | :bag
  | :duplicate_bag
  | {:name, atom()}
```

# `opts`

```elixir
@type opts() :: [
  name: atom(),
  pid: pid(),
  global_ttl: non_neg_integer() | :infinity,
  acquire_lock_timeout: pos_integer(),
  touch_on_read: boolean() | nil,
  ttl_check_interval: non_neg_integer() | false,
  ets_options: [ets_option()]
]
```

# `dirty_get_or_store`

# `get_or_store`

Implements a version of get_or_store that locks locally
so only one process runs `store_fun` at a time.

Any other processes that miss cache will wait for the first
caller to finish `store_fun` then will read the result from cache.

# `native_term_storage?`

ConCache is ETS-backed and stores terms. Encoding is pure overhead, and it made
`get_or_store/3` unusable — that function writes through ConCache directly, bypassing
the encode in `Cache.put/3`, so a later `get/1` tried to `binary_to_term/1` a raw term
and raised.

---

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