- How does Varnish caching make your site faster?
- How to install and activate it?
- Limitations you should be aware of
- Set cache time-to-live (TTL)
- Set up custom permalinks
- Purge Performance Cache
How does Varnish caching make your site faster?
The first time that a visitor visits your site, the Performance Cache plugin saves a copy of your site on a Varnish server. All subsequent visitors will be served with this copy, which takes less time than getting it from the storage server, thus making your site load faster.
The people behind Varnish have done a very good job of explaining how it works in the video below.
How to install and activate it?
The Performance Cache plugin is enabled by default if you have used the 1-click installer to install WordPress. It will be visible in the menu to the left in your WordPress dashboard.
If the plugin is not enabled you can do this manually from the One.com parent plugin.
- In your WordPress dashboard, click One.com > Plugins.
- On the Performance Cache tile, click Install and then Activate.
- Done! Click Performance Cache to adjust settings.
Note: The Performance Cache plugin is not available on the Starter packages. You need to have a WordPress package, or a Plus/Business package with 200GB web space or more.
Limitations you should be aware of
There are some limitations you should be aware of when using the Performance Cache plugin.
- Each URL of your site needs to have been visited at least once before it is shopd in the Performance Cache. So some pages of your site might be shopd in the cache and some not.
- If you have a lot of dynamic content, like for example a header with changing images, we recommend disabling the Performance Cache plugin. This is because the cached copy of your site on the Varnish server, may not be the same as the actual site.
- Plugins that require PHP executions don't work correctly with Performance Cache enabled, for example, visitor counters.
Set cache time-to-live (TTL)
By default, the cache is set for 30 days, or 2592000 seconds. In most cases this is fine.
If you have a site with regular updates or if you are currently working on it, we recommend lowering it.
- In your WordPress dashboard, click Performance Cache.
- Type in a new value for TTL.
- Click Save changes.
Tip: If you are working on a new version of your site, we recommend trying out the One.com Staging plugin. It allows you to try out changes, without your visitors noticing.
Set up custom permalinks
To make sure that the Performance Cache plugin is working as intended, you need to have custom permalink settings. Luckily this is very easy.
- Click Settings > Permalinks.
- Select a custom permalink setting.
- Scroll down and click Save changes.
Purge Performance Cache
If you don't want to wait until the cache is updated automatically, you can purge the Varnish cache manually. That way you can check the latest changes on your site right away.
- Go to Performance Cache in your WordPress dashboard.
- Click Purge Performance Cache.
The cache is purged automatically in the following cases.
- A page or post is added/updated.
- The active theme is changed.
- Performance Cache settings are saved.
- Widgets on your site are added/updated.