Note: This article gives an overview of Redis Page Caching which is enabled via the toggle in the dashboard. The plugin Nginx Helper is used alongside it to enable easy purging.
The GridPane Nginx Stack also features Redis page and static asset caching as a high speed and reliable in memory solution.
Most people know and use Redis as a highly efficient, powerfully configurable, and incredibly fast object cache for things such as Database queries, but it can also serve double duty as a static caching solution integrated with Nginx.
1. Enable Nginx Redis Page Caching
Click on your site in the Active Sites panel to open the Site Customizer
Enable the Redis Caching Toggle
Your site will now have Nginx Redis Caching enabled with GridPane custom configurations.
If you visit your site and check the response headers using the site inspector you will see that caching has been enabled.
2. Enable Redis Cache Purging
Nginx cache purging is one of the premium features of the Nginx Plus platform but, as is usual with the open source community, a resourceful community member has stepped into the gap and provided an invaluable asset to enable cache purging on the FOSS version of Nginx.
The GridPane stack is custom compiled with the redis-nginx, redis2-nginx, and srcache-nginx-module, which allow for a Redis server to be used as a static cache, and enable cache purging when content updates.
To enable cache purging we have installed and activated the Nginx Helper plugin.
This plugin allows for the incremental purging of your sites cache when you update content, such as posts, pages, comments etc. The plugin has been installed, but you need to configure it to suit your specific purge requirements.
You can find it under Settings Nginx Helper
You will need to check Enable Purge, and select Redis cache as the Caching Method.
Under Redis Settings, make sure Hostname is set to 127.0.0.1 with a Port of 6379, and Prefix is set to nginx-cache: (the trailing colon is required).
Under Purging Conditions you should select what content you would like to trigger the purging and updating of cache.
Click Save All Changes when you have configured the options to suit your needs and now the cache will automatically purge outdated content as you update your GridPane site content.
What if I delete the Nginx Helper Plugin?
If you delete the Nginx Helper plugin, then the server will have difficulty clearing the cache on content updates, instead you will need to use the GridPane Tools to clear the cache.
You can always download and re-install the Nginx Helper plugin from the WordPress Org Repository at any time, this can be done directly from the plugins interface in wp-admin.