Unverified Commit e26d683b authored by Steven's avatar Steven Committed by GitHub

chore(docs): update minimumCacheTTL example to 31 days (#76796)

The docs for `minimumCacheTTL` showed the default but didn't show an
example of changing it.

Based on looking at many websites and the frequency those images change,
I think 31 days is a good choice.
parent 170e8a4a
...@@ -753,10 +753,22 @@ The expiration (or rather Max Age) is defined by either the [`minimumCacheTTL`]( ...@@ -753,10 +753,22 @@ The expiration (or rather Max Age) is defined by either the [`minimumCacheTTL`](
You can configure the Time to Live (TTL) in seconds for cached optimized images. In many cases, it's better to use a [Static Image Import](/docs/app/building-your-application/optimizing/images#local-images) which will automatically hash the file contents and cache the image forever with a `Cache-Control` header of `immutable`. You can configure the Time to Live (TTL) in seconds for cached optimized images. In many cases, it's better to use a [Static Image Import](/docs/app/building-your-application/optimizing/images#local-images) which will automatically hash the file contents and cache the image forever with a `Cache-Control` header of `immutable`.
If no configuration is provided, the default below is used.
```js filename="next.config.js"
module.exports = {
images: {
minimumCacheTTL: 60, // 1 minute
},
}
```
You can increase the TTL to reduce the number of revalidations and potentionally lower cost:
```js filename="next.config.js" ```js filename="next.config.js"
module.exports = { module.exports = {
images: { images: {
minimumCacheTTL: 60, minimumCacheTTL: 2678400, // 31 days
}, },
} }
``` ```
......
...@@ -550,10 +550,22 @@ The expiration (or rather Max Age) is defined by either the [`minimumCacheTTL`]( ...@@ -550,10 +550,22 @@ The expiration (or rather Max Age) is defined by either the [`minimumCacheTTL`](
You can configure the Time to Live (TTL) in seconds for cached optimized images. In many cases, it's better to use a [Static Image Import](/docs/pages/building-your-application/optimizing/images#local-images) which will automatically hash the file contents and cache the image forever with a `Cache-Control` header of `immutable`. You can configure the Time to Live (TTL) in seconds for cached optimized images. In many cases, it's better to use a [Static Image Import](/docs/pages/building-your-application/optimizing/images#local-images) which will automatically hash the file contents and cache the image forever with a `Cache-Control` header of `immutable`.
If no configuration is provided, the default below is used.
```js filename="next.config.js"
module.exports = {
images: {
minimumCacheTTL: 60, // 1 minute
},
}
```
You can increase the TTL to reduce the number of revalidations and potentionally lower cost:
```js filename="next.config.js" ```js filename="next.config.js"
module.exports = { module.exports = {
images: { images: {
minimumCacheTTL: 60, minimumCacheTTL: 2678400, // 31 days
}, },
} }
``` ```
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment