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

# Semantic cache

> Public semantic cache signatures and configuration in @agentium/core 4.0.0.

Import these **3 exports** from `@agentium/core`. Read the [semantic cache guide](/cache/overview) for setup and behavior, or return to the [package reference](/api-reference/core).

A `?` marks an optional field. These are declarations for lookup; run the examples in the linked guide. Follow related-type links for Agentium types and source links for imported dependency types.

## CacheHit

[Source](https://github.com/agentiumOS/agentium/blob/v4.0.0/packages/core/src/cache/types.ts)

```typescript theme={null}
export interface CacheHit {
    id: string;
    output: RunOutput;
    score: number;
    cachedAt: number;
}
```

Related: [`RunOutput`](/api-reference/core/agent#runoutput).

## SemanticCache

[Source](https://github.com/agentiumOS/agentium/blob/v4.0.0/packages/core/src/cache/semantic-cache.ts)

```typescript theme={null}
export declare class SemanticCache {
    constructor(config: SemanticCacheConfig);
    lookup(input: string, agentName?: string, sessionId?: string): Promise<CacheHit | null>;
    store(input: string, output: RunOutput, agentName?: string, sessionId?: string): Promise<void>;
    invalidate(id: string, agentName?: string, sessionId?: string): Promise<void>;
    clear(agentName?: string, sessionId?: string): Promise<void>;
}
```

Related: [`CacheHit`](/api-reference/core/cache#cachehit), [`RunOutput`](/api-reference/core/agent#runoutput), [`SemanticCacheConfig`](/api-reference/core/cache#semanticcacheconfig).

## SemanticCacheConfig

[Source](https://github.com/agentiumOS/agentium/blob/v4.0.0/packages/core/src/cache/types.ts)

```typescript theme={null}
export interface SemanticCacheConfig {
    vectorStore: VectorStore;
    embedding: EmbeddingProvider;
    similarityThreshold?: number;
    ttl?: number;
    collection?: string;
    maxEntries?: number;
    scope?: "global" | "agent" | "session";
}
```

Related: [`EmbeddingProvider`](/api-reference/core/vector#embeddingprovider), [`VectorStore`](/api-reference/core/vector#vectorstore).


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