# `PhoenixKit.Modules.Sitemap.Cache`
[🔗](https://github.com/BeamLabEU/phoenix_kit/blob/v1.7.165/lib/modules/sitemap/cache.ex#L1)

Caching layer for sitemap generation.

Manages ETS cache for entries, per-module XML, and index XML.
When invalidated, clears ETS cache and deletes sitemap files.

## Cache Key Scheme

- `:index_xml` - The sitemapindex XML content
- `{:module_xml, "sitemap-shop"}` - Per-module XML content
- `{:module_entries, :shop}` - Per-module collected entries
- `:entries` - All collected entries (legacy)
- `:parts` - Sitemap index parts (legacy)

# `delete`

```elixir
@spec delete(term()) :: :ok
```

Deletes a specific cache entry.

# `get`

```elixir
@spec get(term()) :: {:ok, any()} | :error
```

Retrieves a cached value by key.

# `get_module`

```elixir
@spec get_module(String.t()) :: {:ok, String.t()} | :error
```

Gets cached XML content for a specific module.

# `has?`

```elixir
@spec has?(term()) :: boolean()
```

Checks if a cached value exists for the given key.

# `init`

```elixir
@spec init() :: :ok
```

Initializes the ETS cache table.

Safe to call multiple times - returns :ok if table already exists.

# `invalidate`

```elixir
@spec invalidate() :: :ok
```

Clears all cached data and deletes all sitemap files.

Should be called when sitemap content changes.

# `invalidate_all`

```elixir
@spec invalidate_all() :: :ok
```

Alias for `invalidate/0`.

# `invalidate_module`

```elixir
@spec invalidate_module(String.t()) :: :ok
```

Invalidates all cache keys for a specific source module.

# `put`

```elixir
@spec put(term(), any()) :: :ok
```

Stores a value in cache with the given key.

# `put_module`

```elixir
@spec put_module(String.t(), String.t()) :: :ok
```

Caches XML content for a specific module.

# `stats`

```elixir
@spec stats() :: map()
```

Returns cache statistics.

---

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