The Servebolt Magento 2 cache plugin makes sites on the fastest Magento 2 hosting, even faster. It does this by making cache headers for the HTML that allows HTML caching on the web server and in the browser.
The frontend caches layer on top of the built-in caching in Magento, and eliminates the need for Varnish. It seamlessly integrates with the Servebolt hosting stack that uses nginx as the internet facing web server.
For the admin section and dynamic parts of the store, the frontend cache bypasses requests with the no_cache cookies the cache.
Go to your Magento root folder (~/public/ on Servebolt)
$ composer config repositories.servebolt-m2cache git https://github.com/Servebolt/m2cache.git
$ composer require servebolt/module-m2cache dev-master
If you have not already configured composer, you will be prompted for username and password for repo.magento.com. You get these by signing up on Magento marketplace.
Enable the module and activate it in Magento using the magento command.
$ magento module:enable Servebolt_M2Cache
$ magento setup:upgrade
$ magento config:set --scope=default --scope-code=0 system/full_page_cache/servebolt_m2c/enabled 1
$ magento cache:flush
Enable the module and activate it in Magento using n98-magerun2.
$ magerun2 module:enable Servebolt_M2Cache
$ magerun2 setup:upgrade
$ magerun2 config:store:set system/full_page_cache/servebolt_m2c/enabled 1
$ magerun2 cache:flush
In the Servebolt Control Panel the Caching setting for your site has to be set to "Static files + Full-Page Cache".
In the Magento Admin the cache setting can be set/checked here:
Use default settings for Caching Application (Built-in cache) and TTL (86400) for public content.
When the plugin is working correctly, the headers of a cached HTML document will look something like this:
x-frontend-cache can have the values HIT, MISS, BYPASS or STALE. If the header is not present at all, the cache setting for the site is not enabled in the Servebolt control panel.
expires is set to a future date, in this example approximately 10 minutes from the current time, which is the 600 second default setting. The cache expiry time is configurable.
The default expires 600, up to 3600 to set to 1 hour.
$ magerun2 config:store:set system/full_page_cache/servebolt_m2c/headers/expires/lifetime 3600
composer remove servebolt/module-m2cache
The Servebolt Page Cache is made to be unmanaged. This means that the cache will manage itself, and expire pages from the cache within reasonable time. This also means that you do not need to worry about flushing or managing this cache.
The built-in Magento caches on the other hand, can still be managed from the System > Stores > Cache Management page. Emptying this page cache will clear the Magento-internal page cache, but not necessarily expire the Servebolt cache right away. If installed with the default settings, expect the HTML to be refreshed within 10 minutes.