> ## Documentation Index
> Fetch the complete documentation index at: https://si.easyaf.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# IDistributedCache

> Authenticated task store over whatever IDistributedCache you already registered. Specified; not in this repository yet.

> [!WARNING]
>
> `McpEssentials.DistributedCache` is specified and is not in this repository yet.

Use this when the host already registered `IDistributedCache` (Redis, NCache, SQL Server cache, FusionCache, …) and you want tasks on that abstraction.

> [card] When it ships
>
> The cache abstraction is already in DI and a host-supplied bus covers fan-out.

> [card] [Until then](https://si.easyaf.dev/mcpessentials/guides/stores/redis.md)
>
> Prefer Redis when the cache is Redis and you need pub/sub for elicitation.

## Intended how-to

**1. Add the package**

Add `McpEssentials.DistributedCache`.

**2. Key the snapshot**

Serialize the canonical `StoredMcpTask` record with source-generated JSON. Key `mcp:task:{taskId}`.

**3. Register the store**

Singleton, same current-user factory as [Authenticated tasks](https://si.easyaf.dev/mcpessentials/guides/authenticated-tasks.md).

**4. Optional bus**

`IDistributedCache` has no pub/sub. For multi-node `ElicitAsync`, register [`IMcpTaskInputSignalBus`](https://si.easyaf.dev/mcpessentials/api-reference/CloudNimble/McpEssentials/Core/Tasks/IMcpTaskInputSignalBus). Single-node hosts can skip the bus.

## TTL

Set cache entry expiry from `DiscardAfter` (`CreatedAt + 2×TimeToLive`). A missing key is not found.

## Related

> [card] [Redis](https://si.easyaf.dev/mcpessentials/guides/stores/redis.md)
>
> Shipped. Native `PEXPIREAT` plus pub/sub.

> [card] [Stores](https://si.easyaf.dev/mcpessentials/guides/stores.md)
>
> Pick a backing store by the engine you already run.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.