# `Nebulex.Distributed.Cluster`
[🔗](https://github.com/elixir-nebulex/nebulex_distributed/blob/v3.2.3/lib/nebulex/distributed/cluster.ex#L1)

This module is used by cache adapters for distributed caching functionality.

# `find_node`

```elixir
@spec find_node(ExHashRing.Ring.ring(), any()) ::
  {:ok, node()} | {:error, Nebulex.Error.t()}
```

Finds a node in the ring.

# `join`

```elixir
@spec join(name :: atom()) :: :ok
```

Joins the node where the cache `name`'s supervisor process is running to the
`name`'s node group.

# `leave`

```elixir
@spec leave(name :: atom()) :: :ok
```

Makes the node where the cache `name`'s supervisor process is running, leave
the `name`'s node group.

# `monitor_scope`

```elixir
@spec monitor_scope() :: reference()
```

Wrapper for `:pg.monitor_scope/1`.

# `pg_child_spec`

```elixir
@spec pg_child_spec() :: Supervisor.child_spec()
```

Returns the `:pg` child spec.

# `pg_nodes`

```elixir
@spec pg_nodes(name :: atom()) :: [node()]
```

Returns the list of nodes joined to given `name`'s node group.

# `pg_scope`

```elixir
@spec pg_scope() :: atom()
```

Returns the `:pg` scope.

# `ring_nodes`

```elixir
@spec ring_nodes(ExHashRing.Ring.ring()) :: [node()]
```

Returns the list of nodes in the ring.

---

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