mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-14 18:13:54 +00:00
Update README.md
This commit is contained in:
parent
dcadb277ee
commit
b34a408224
@ -1,30 +1,3 @@
|
|||||||
# Cached Components
|
# Cached Components
|
||||||
|
|
||||||
> Nuxt.js use [lru-cache](https://github.com/isaacs/node-lru-cache) to allows cached components for better render performances
|
https://nuxtjs.org/examples/cached-components
|
||||||
|
|
||||||
## Usage
|
|
||||||
|
|
||||||
Use the `cache` key in your `nuxt.config.js`:
|
|
||||||
```js
|
|
||||||
module.exports = {
|
|
||||||
cache: true
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
`cache` can be a Boolean or an Object, if an object, you can use theses keys:
|
|
||||||
|
|
||||||
| key | Optional? | Type | Default | definition |
|
|
||||||
|------|------------|-----|---------|------------|
|
|
||||||
| `max` | Optional | Integer | 1000 | The maximum size of the cached components, when the 1001 is added, the first one added will be removed from the cache to let space for the new one. |
|
|
||||||
| `maxAge` | Optional | Integer | 900000 | Maximum age in ms, default to 15 minutes. |
|
|
||||||
|
|
||||||
Other options: https://github.com/isaacs/node-lru-cache#options
|
|
||||||
|
|
||||||
## Demo
|
|
||||||
|
|
||||||
```bash
|
|
||||||
npm install
|
|
||||||
npm start
|
|
||||||
```
|
|
||||||
|
|
||||||
Go to [http://localhost:3000](http://localhost:3000)
|
|
||||||
|
Loading…
Reference in New Issue
Block a user