forked from vercel/next.js
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add configuration for LRU Cache Size (vercel#21535)
This allows the user to adjust the LRU cache size according to the application need: - optimize the cache size based on average page HTML & JSON size - remove the cache limit and let it grow to cache all pages - make it so small to practically disable it The hard-coded default of 50MB has been moved from the code to the default configuration object. Fixes vercel#21535 See also vercel#27325
- Loading branch information
Showing
4 changed files
with
35 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
--- | ||
description: Control the size of the LRU cache in Next.js | ||
--- | ||
|
||
# LRU Cache Size | ||
|
||
<details> | ||
<summary><b>Version History</b></summary> | ||
|
||
| Version | Changes | | ||
| --------- | --------------------- | | ||
| `v11.0.2` | LRU Cache Size added. | | ||
|
||
</details> | ||
|
||
Next.js keeps the data for frequently accessed paths in a least recently used (LRU) cache in memory. | ||
`lruCacheSize` allows you to adjust the cache size for the application. | ||
|
||
Setting it to 0 will remove the size restriction and the cache will only grow. | ||
|
||
Setting it to 1 will basically disable the cache as it will only ever contain the data for the last | ||
accessed path. | ||
|
||
The default is 50MB: | ||
|
||
```js | ||
module.exports = { | ||
lruCacheSize: 50 * 1024 * 1024, | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters