Skip to content

Using Page Cache

Yash Thakur edited this page Oct 7, 2017 · 1 revision

Page Caching

Individual page caching is by default enabled for all the pages in production mode. If you want to change the settings for cache, you can change by adding cache object in the routes.

It has two properties:
enable : true/false (boolean)
duration : 3600 (Number)

enabled mentions whether the page should be cached or not by the browser. It is helpful when pages are static.

The duration mentions the amount of time(in seconds) the page should be cached by the browser.

{
    path: "/",
    exact: true,
    component: Home,
    layout: DefaultLayout,
    cache: {
        // default enabled in production mode
        enable: true,
       // default 1 year, but you can specify duration in seconds
        duration: 3600
    }
}
Clone this wiki locally