# `SuperCache.Sup`
[🔗](https://github.com/ohhi-vn/super_cache/blob/main/lib/app/sup.ex#L1)

Dynamic supervisor for user-spawned workers in SuperCache.

This module provides a `DynamicSupervisor` that allows runtime creation
and management of child processes. It is primarily used for starting
buffer streams and other dynamically allocated resources.

## Example

    # Start a single worker
    {:ok, pid} = SuperCache.Sup.start_worker({MyWorker, []})

    # Start multiple workers
    workers = [{Worker1, []}, {Worker2, []}]
    results = SuperCache.Sup.start_workers(workers)

# `child_spec`

Returns a specification to start this module under a supervisor.

See `Supervisor`.

# `start_link`

```elixir
@spec start_link(keyword()) :: :ignore | {:error, any()} | {:ok, pid()}
```

Starts the dynamic supervisor linked to the current process.

The supervisor is registered under the name `SuperCache.Sup`.

# `start_worker`

```elixir
@spec start_worker(Supervisor.child_spec() | {module(), term()} | module()) ::
  {:ok, pid()} | {:error, term()}
```

Starts a single child specification under this supervisor.

Returns `{:ok, pid}` on success or `{:error, reason}` on failure.

# `start_workers`

```elixir
@spec start_workers([Supervisor.child_spec() | {module(), term()} | module()]) :: [
  ok: pid(),
  error: term()
]
```

Starts a list of child specifications under this supervisor.

Returns a list of `{:ok, pid}` or `{:error, reason}` tuples corresponding
to each child specification.

## Examples

    SuperCache.Sup.start_workers([{MyWorker, arg1}, {OtherWorker, arg2}])
    # => [{:ok, #PID<0.100.0>}, {:ok, #PID<0.101.0>}]

# `stop_worker`

```elixir
@spec stop_worker(pid() | atom()) :: :ok | {:error, term()}
```

Terminates a child process identified by `pid` or `name`.

# `terminate`

---

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