> Portal Navigation:
> 
> - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version.
> - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages).
> - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`).
> - Top-level index of all portals: https://dev.wix.com/docs/llms.txt
> - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt

## Resource: About Cached Queries

## Article: About Cached Queries

## Article Link: https://dev.wix.com/docs/studio-two/code-your-site/work-with-data/data-api/about-cached-queries.md

## Article Content:

# About Cached Queries

The Data API caches the results of some queries on a content delivery network (CDN). When a visitor runs a query whose results are already cached, Wix returns the cached results instead of querying the database again. This makes those queries much faster.

Caching happens automatically. Knowing when it applies helps you design collections and queries that benefit from it.

## Which queries are cached

The Data API caches a query's results only when all of these conditions are true:

- **Read only**: The query doesn't change the collection or its items.
- **User-created collection**: The collection is a [user-created collection](https://dev.wix.com/docs/studio-two/code-your-site/work-with-data/introduction/about-collections.md#collection-types). It isn't an [external collection](https://dev.wix.com/docs/studio-two/code-your-site/work-with-data/external-databases/about-external-databases.md) or an [app collection](https://dev.wix.com/docs/studio-two/code-your-site/work-with-data/introduction/about-collections.md#app-collections).
- **Read-only permissions for visitors**: The collection's [permissions](https://dev.wix.com/docs/studio-two/code-your-site/work-with-data/introduction/about-collections.md#permissions) don't let anonymous visitors add, update, or remove items.
- **Frontend request**: The query runs in frontend code, not backend code.
- **Visitor request**: The query runs on behalf of a site visitor, not a logged-in member.
- **No personal data**: The request doesn't contain personally identifiable information.
- **Default consistency**: The query doesn't override eventual consistency with `consistentRead: true`.
- **No item visibility rules**: The collection doesn't have item visibility rules enabled.

## When the cache clears

Wix clears cached results automatically so that visitors get current data. The cache clears when:

- **Data changes**: Any request changes the collection or its items.
- **Related data changes**: A collection that a cached query references changes.
- **The site is published**: Publishing the site clears its cached results.
- **A week passes**: Results expire after they've been cached for a week.

To get the most from caching, keep data that rarely changes in different collections from data that changes often. The stable collections then stay cached longer.

### Eventual consistency

Clearing the cache can take a few seconds, which can make the effects of [eventual consistency](https://dev.wix.com/docs/api-reference/business-solutions/cms/eventual-consistency.md) more noticeable. If you need the latest data immediately after a change, set `consistentRead` to `true` in the query's options.

## Monitoring

**Developer Tools > Monitoring**, in the site dashboard, shows a site's data requests. Cached requests count toward the request totals, and errors in cached queries are reported, but the page doesn't show which requests were served from the cache.

## See also

- [About the Data API](https://dev.wix.com/docs/studio-two/code-your-site/work-with-data/data-api/about-the-data-api.md)
- [Query Items](https://dev.wix.com/docs/studio-two/code-your-site/work-with-data/data-api/query-items.md)
- [Eventual consistency](https://dev.wix.com/docs/api-reference/business-solutions/cms/eventual-consistency.md)