-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Traduction de cached-components.md
#29
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,27 @@ | ||
--- | ||
title: Caching Components | ||
description: How to cache components? | ||
title: Composants avec cache | ||
description: Comment mettre en cache des composants ? | ||
--- | ||
|
||
# How to cache Vue components? | ||
# Comment mettre en cache des composants Vue ? | ||
|
||
> Although Vue's SSR is quite fast, it can't match the performance of pure string-based templating due to the cost of creating component instances and Virtual DOM nodes. In cases where SSR performance is critical, wisely leveraging caching strategies can greatly improve response time and reduce server load. | ||
> Bien que le rendu côté serveur de Vue soit rapide, il ne rivalise pas avec les performances d'un template basé sur une chaine de caractère pure, et ceux, à cause du coût de création des instances de composant et des nœuds du DOM virtuel. Dans le cas où les performances du rendu côté serveur est critique, mettre en place une bonne stratégie de mise en cache peut grandement améliorer le temps de réponse et réduire la charge serveur. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. "à cause du cout" |
||
|
||
To avoid boilerplate, use [Component Cache module](https://github.com/nuxt-community/modules/tree/master/packages/component-cache) for Nuxt.js. | ||
This module uses vue-server-renderer to add LRU cache support for Vue components. | ||
Vous pouvez utiliser le module [Component Cache](https://github.com/nuxt-community/modules/tree/master/packages/component-cache) pour Nuxt.js. | ||
Ce module utilise `vue-server-renderer` pour ajouter le support d'un cache [LRU](https://fr.wikipedia.org/wiki/Algorithmes_de_remplacement_des_lignes_de_cache#LRU_.28Least_Recently_Used.29) pour les composants Vue. | ||
|
||
## Usage | ||
## Utilisation | ||
|
||
- Ajoutez la dépendance `@nuxtjs/component-cache` en utilisant Yarn ou npm pour votre projet. | ||
- Ajoutez `@nuxtjs/component-cache` to `modules` section of `nuxt.config.js`. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ajoutez |
||
|
||
- Add `@nuxtjs/component-cache` dependency using yarn or npm to your project | ||
- Add `@nuxtjs/component-cache` to `modules` section of `nuxt.config.js` | ||
```js | ||
{ | ||
modules: [ | ||
// Simple usage | ||
// Utilisation simple | ||
'@nuxtjs/component-cache', | ||
|
||
// With options | ||
// Avec des options | ||
['@nuxtjs/component-cache', { | ||
max: 10000, | ||
maxAge: 1000 * 60 * 60 | ||
|
@@ -29,12 +30,11 @@ This module uses vue-server-renderer to add LRU cache support for Vue components | |
} | ||
``` | ||
|
||
See [component-level caching](http://ssr.vuejs.org/en/caching.html#component-level-caching) for more information. | ||
|
||
## Don't forget, that | ||
Voir [la mise en cache au niveau composant](http://ssr.vuejs.org/en/caching.html#mise-en-cache-au-niveau-du-composant) pour plus d'informations. | ||
|
||
- Cache-able component **must define a unique `name` option**. | ||
- You should ***NOT*** cache components, that | ||
- has child components that may rely on global state. | ||
- has child components that produces side effects on the render `context`. | ||
## N'oubliez pas | ||
|
||
- Les composants à mettre en cache **doivent définir une option `name` unique**. | ||
- Vous **NE** devez ***PAS*** mettre en cache un composant si | ||
- ses composants enfants sont liés à ur état global ou si | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ses composants enfants sont liés à ur état global ou si => ses composants enfants sont liés à l'état global |
||
- ses composants enfants produisent des effets de bord sur le rendu de `context`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Composants avec cache => Mettre en cache les composants