---
title: useCache
description: Learn how to enable the useCache flag in Next.js.
url: "https://nextjs.org/docs/15/app/api-reference/config/next-config-js/useCache"
version: 15.5.15
lastUpdated: 2025-07-17
prerequisites:
  - "Configuration: /docs/15/app/api-reference/config"
  - "next.config.js: /docs/15/app/api-reference/config/next-config-js"
---



> This feature is currently available in the canary channel and subject to change.

The `useCache` flag is an experimental feature in Next.js that enables the [`use cache` directive](/docs/app/api-reference/directives/use-cache) to be used independently of [`cacheComponents`](/docs/app/api-reference/config/next-config-js/cacheComponents). When enabled, you can use `use cache` in your application even if `cacheComponents` is turned off.

## Usage

To enable the `useCache` flag, set it to `true` in the `experimental` section of your `next.config.ts` file:

```ts filename="next.config.ts"
import type { NextConfig } from 'next'

const nextConfig: NextConfig = {
  experimental: {
    useCache: true,
  },
}

export default nextConfig
```

When `useCache` is enabled, you can use the following cache functions and configurations:

* The [`use cache` directive](/docs/app/api-reference/directives/use-cache)
* The [`cacheLife` function](/docs/app/api-reference/config/next-config-js/cacheLife) with `use cache`
* The [`cacheTag` function](/docs/app/api-reference/functions/cacheTag)
---

For an index of all available documentation, see [/docs/15/llms.txt](/docs/15/llms.txt)