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

# Cache

In PHPFast Framework, caching is a crucial technique to improve performance, reduce server load, and enhance user experience. There are various caching strategies available, and choosing the right one depends on the specific requirements of your application. Here, we introduce three popular caching options: `UriCache`, `RedisCache`, and `FilesCache`.

You can see how to use at [Guide Usage Cache](/documents/drivers/cache/guide-usage-cache.md)

## [Uri Cache](/documents/drivers/cache/uri-cache.md)

`UriCache` is designed to cache responses based on the URI (Uniform Resource Identifier). It is particularly useful for caching complete HTML pages or API responses that are identified by their URI.

**Feature:**&#x20;

* **Easy to Implement**: Simple to implement and use.
* **Effective for Static Pages**: Effective for static pages or pages with content that does not change frequently.
* **No Additional Setup Required**: Does not require additional software or services to be installed.

**When to Use:**

* When you need to cache complete HTML pages based on the URI.
* When you need a simple caching solution without requiring additional software.
* When you want to reduce server load by caching API responses based on the URI.

## [Redis Cache](/documents/drivers/cache/redis-cache.md)

`RedisCache` uses Redis, an in-memory data store, to store cache. Redis is a popular choice for caching due to its high performance and scalability.

**Feature:**&#x20;

* **High Performance**: Redis stores data in memory, making data retrieval very fast.
* **Supports Multiple Data Types**: Redis supports various data types such as strings, lists, sets, and hashes.
* **Scalable**: Redis can be easily scaled to handle large amounts of data.
* **Supports Distribution**: Redis supports distribution, increasing the system's load-handling capacity.

**When to Use**:

* When you need high performance and fast data retrieval.
* When you need to store and retrieve complex data types.
* When you need a scalable caching solution that supports distribution.
* When you need to cache temporary data such as sessions, authentication tokens, or frequently changing data.

## [Files Cache](/documents/drivers/cache/files-cache.md)

`FilesCache` stores cache as files on the server's file system. This is a simple and easy-to-implement caching solution.

**Feature:**&#x20;

* **Easy to Implement**: Simple to implement and use without requiring additional software.
* **Dependent on File System**: Performance depends on the file system's access speed.
* **Not Suitable for Large Data**: Not suitable for storing and retrieving large amounts of data or frequently changing data.

**When to Use**:

* When you need a simple caching solution without requiring additional software.
* When you need to cache temporary data and do not require high performance.
* When you need to store cache on the server's file system and the data does not change frequently.

{% hint style="success" %}
Summary

* [**`UriCache`**](/documents/drivers/cache/uri-cache.md): Use when you need to cache complete HTML pages or API responses based on the URI. Suitable for static pages or content that does not change frequently.
* [**`RedisCache`**](/documents/drivers/cache/redis-cache.md): Use when you need high performance, fast data retrieval, and scalability. Suitable for temporary data, sessions, and frequently changing data.
* [**`FilesCache`**](/documents/drivers/cache/files-cache.md): Use when you need a simple caching solution without requiring additional software. Suitable for temporary data and when high performance is not required.

Choosing the appropriate type of cache depends on the specific requirements of the application and the deployment environment.
{% endhint %}


---

# 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, and the optional `goal` query parameter:

```
GET https://docs.cmsfullform.com/documents/drivers/cache.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
