# `Electric.ShapeCache`
[🔗](https://github.com/electric-sql/electric/tree/%40core/sync-service%401.6.2/packages/sync-service/lib/electric/shape_cache.ex#L1)

# `handle_position`

```elixir
@type handle_position() ::
  {shape_handle(),
   current_snapshot_offset :: Electric.Replication.LogOffset.t()}
```

# `shape_def`

```elixir
@type shape_def() :: Electric.Shapes.Shape.t()
```

# `shape_handle`

```elixir
@type shape_handle() :: Electric.shape_handle()
```

# `stack_id`

```elixir
@type stack_id() :: Electric.stack_id()
```

# `activate_mocked_functions_from_test_process`

# `await_snapshot_start`

```elixir
@spec await_snapshot_start(shape_handle(), stack_id(), non_neg_integer()) ::
  :started | {:error, term()}
```

# `child_spec`

Returns a specification to start this module under a supervisor.

See `Supervisor`.

# `clean_shape`

```elixir
@spec clean_shape(shape_handle(), stack_id()) :: :ok
```

# `count_shapes`

```elixir
@spec count_shapes(stack_id()) :: non_neg_integer() | :error
```

# `fetch_handle_by_shape`

```elixir
@spec fetch_handle_by_shape(shape_def(), stack_id()) :: {:ok, shape_handle()} | :error
```

# `fetch_shape_by_handle`

```elixir
@spec fetch_shape_by_handle(shape_handle(), stack_id()) ::
  {:ok, Electric.Shapes.Shape.t()} | :error
```

# `get_or_create_shape_handle`

```elixir
@spec get_or_create_shape_handle(shape_def(), stack_id(), opts :: Access.t()) ::
  handle_position() | {:error, term()}
```

# `has_shape?`

```elixir
@spec has_shape?(shape_handle(), Access.t()) :: boolean()
```

# `list_shapes`

```elixir
@spec list_shapes(stack_id()) ::
  [{shape_handle(), Electric.Shapes.Shape.t()}] | :error
```

# `name`

# `resolve_shape_handle`

```elixir
@spec resolve_shape_handle(shape_handle(), shape_def(), stack_id(), keyword()) ::
  handle_position() | nil
```

# `shape_counts`

```elixir
@spec shape_counts(stack_id()) ::
  %{
    total: non_neg_integer(),
    indexed: non_neg_integer(),
    unindexed: non_neg_integer()
  }
  | :error
```

# `start_consumer_for_handle`

```elixir
@spec start_consumer_for_handle(shape_handle(), stack_id()) ::
  {:ok, pid()} | {:error, :no_shape}
```

# `start_link`

---

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