> For the complete documentation index, see [llms.txt](https://genaistack.aiplanet.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://genaistack.aiplanet.com/components/llm-cache.md).

# ️️️🗃️ LLM Cache

The LLM Cache component is responsible for managing the cache of the language model (LLM). It is responsible for storing and retrieving the cache. It can be used to store the cache in a preferred vector database (weaviate or chromadb). This component is optional and can be used to improve the performance of the stack. It reduces the number of queries to the LLM and is cost-effective.

**Setting the cache** : The LLM Cache component is responsible for setting the cache of the language model (LLM). It can store the query and response along with their metadata in the cache.

**Getting the cache** : The LLM Cache component is responsible for getting the cache of the language model (LLM). It does a hybrid search based on the query and metadata to retrieve the cache. The returned cache will contain the expected response for the query.

The stack can be used without the LLM Cache component. In this case, the stack will directly interact with the LLM to generate the response.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://genaistack.aiplanet.com/components/llm-cache.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
