# Cache

> This document is the Markdown version of [valibot.dev/api/Cache/](https://valibot.dev/api/Cache/). For the complete documentation index, see [llms.txt](https://valibot.dev/llms.txt).

Cache interface type.

> Hint: The `key` method uses value-based keys for primitive inputs and reference-identity keys for object and function inputs.

## Generics

- `TValue` `extends any`

## Definition

- `Cache`
  - `key` `(input: unknown, config?: Config<BaseIssue<unknown>>) => string`
  - `get` `((key: string) => TValue | undefined)`
  - `set` `(key: string, value: TValue) => void`
  - `clear` `() => void`
