Free WordPress Cache Enabler Plugin

wordpress cache enabler plugin

The WordPress community is very important to us here at KeyCDN and so that is why we have launched a new caching plugin called Cache Enabler. It’s a light-weight plugin that makes your website faster by generating static HTML files, minification, and WebP support. It’s freely available and a setup can be completed within minutes.

Why KeyCDN Created Cache Enabler

The web is constantly changing and with the release of HTTP/2 the team at KeyCDN was looking for the best way to take advantage of this, and that is why Cache Enabler is entirely focused around this new protocol. While other third-party caching plugins are sometimes overly complex or cost money, we wanted something lightweight and free. A good caching plugin shouldn’t have to cost you money.

HTTP/2 – A New Approach

A lot of the options offered in third-party caching plugins actually become obsolete when you move to HTTP/2, because one of the main goals of the protocol is to reduce the marginal overhead of new requests. You should avoid domain sharding and concatenation of your assets to benefit from parallelism of HTTP/2. This will definitely be a new concept for a lot of people as these techniques have been standard optimization techniques for years. In other words, with HTTP/2 things gets simpler and faster!

Note: You must be running on HTTPs to benefit from HTTP/2 on your server, and that is why we wrote a guide on how to migrate from HTTP to HTTPS. Or use a CDN with HTTP/2 support, like KeyCDN.

WebP Format

Besides the performance benefits of HTTP/2 we also wanted to take advantage of Google’s WebP format. And so with Cache Enabler, when combined with Optimus, you can now serve up WebP images in supported browsers! We are excited to be the very first plugin in the WordPress community to offer WebP support without the use of Javascript. Our Optimus plugin compresses your JPG/PNG files and then also creates a WebP version when uploading to WordPress.

WebP is a new image format that provides lossless and lossy compression for images on the web. WebP lossless images are 26% smaller in size compared to PNGs.

Several big names are already using and experimenting with WebP, such as Facebook, Google, eBay, and Netflix. Smashing Magazine also just recently decided to implement WebP on their website. The WebP format is currently only supported in Google Chrome, Opera, Opera Mini, Android Browser and Chrome for Android. However as of September 2015 Chrome and Opera already have 67.3% of the browser market share, according to w3schools, so over half of your visitors would benefit from WebP. The Cache Enabler plugin then serves up PNG/JPG files to the other 32.7%.

WordPress Cache Enabler Features

The WordPress Cache Enabler plugin creates static HTML files and stores them on your servers disk. The web server will deliver the static HTML file and avoids the resource intensive backend processes (core, plugins and database). This in turn increases the speed of your WordPress site.

  • Efficient and fast disk cache engine
  • Automated and/or manual clearing of the cache
  • Manually purge the cache of specific pages
  • Display of the actual cache size in your dashboard
  • Minification of HTML and inline JavaScript
  • WordPress multisite support
  • Custom Post Type support
  • Expiry Directive
  • Translation ready
  • WebP Support (when combined with Optimus)
  • Supports responsive images via srcset in WordPress 4.4
  • HTTP/2 Focused
  • Works perfectly with Autoptimize

The plugin requires PHP >=5.3 and Wordpress >=4.1.

JPG to WebP Test

We ran a test with 5 large JPG images to demonstrate how much compression actually takes place and the significant size difference between .jpg and .webp files. We are using lossless compression with Optimus to optimize the images and also convert to WebP upon upload to the media library. Cache Enabler then delivers WebP images based on browser support.

jpg-to-webp-2
jpg-to-webp-3
jpg-to-webp-4
jpg-to-webp-5

File Name Original Size Compressed JPG WebP Format Size Difference %
jpg-to-webp-1.jpg 480 KB 407 KB 43 KB 89%
jpg-to-webp-2.jpg 659 KB 578 KB 113 KB 80%
jpg-to-webp-3.jpg 787 KB 715 KB 127 KB 82%
jpg-to-webp-4.jpg 617 KB 543 KB 61 KB 88%
jpg-to-webp-5.jpg 605 KB 543 KB 70 KB 87%

We then ran a page comparison test with GTMetrix, JPG vs WebP, and you can see the total difference in page size. WebP resulted in a 77% decrease in page size. 

Normally we recommend scaling down your images before uploading them to WordPress, but we wanted to show you as aggressive compression tests as possible.

PNG to WebP Test

We then ran a test with 5 large PNG images to demonstrate how much compression actually takes place and the significant size difference between .png and .webp files. We are using lossless compression with Optimus to optimize the images and also convert to WebP upon upload to the media library. Cache Enabler then delivers WebP images based on browser support.

png-to-webp-2
png-to-webp-3
png-to-webp-4
png-to-webp-5

 

File Name Original Size Compressed PNG WebP Format Size Difference %
png-to-webp-1.png 840 KB 790 KB 544 KB 31%
png-to-webp-2.png 903 KB 873 KB 638 KB 26%
png-to-webp-3.png 630 KB 613 KB 414 KB 32%
png-to-webp-4.png 629 KB 606 KB 461 KB 23%
png-to-webp-5.png 959 KB 944 KB 655 KB 30%

We then ran a page comparison test with GTMetrix, PNG vs WebP, and you can see the total difference in page size. WebP resulted in a 27% decrease in page size. These numbers correspond directly with Google’s reported 26% average.

Again normally we recommend scaling down your images before uploading them to WordPress, but we wanted to show you as aggressive compression tests as possible.

Install and Setup Cache Enabler

You can download Cache Enabler from the WordPress repository or install it from within your dashboard.

  1. In your WordPress dashboard click into “Plugins” and then into “Add New.”
  2. Search for “Cache Enabler” on click on “Install Now” and activate the plugin.
  3. On the left-hand side of your dashboard click into “Settings” and into “Cache Enabler.”
  4. You can now configure the following options:
  • Cache Expiry: Cache expiry in hours. An expiry time of 0 means that the cache never expires.
  • Cache Behavior: Disable caching if logged in.
    • Clear the complete cache if a new post has been published (instead of only the home page cache)
    • Clear the complete cache if a new comment has been posted (instead of only page specific cache)
    • Pre-compression of cached pages. Needs to be disabled if the decoding fails in the web browser.
    • Create an additional cache version for WebP image support. Convert your image to WebP with Optimus.
  • Cache Exclusions: Post or Pages IDs separated by a , that should not be cached.
  • Cache Minification: You have the option to minify HTML and HTML + Inline JS.

WordPress cache enabler settings

Verify Cache

The WordPress Cache Enabler plugin actually creates two separate cache (HTML) files, one WebP version and one standard version. Note, after first enabling the cache it does take a few minutes to build up on your disk. To view if the caching is working you can simply look at the source code of your page. You will see “Cache Enabler by KeyCDN” along with the timestamp. Also, if it is delivering the WebP version this will show in a separate comment below it.

Advanced Features

A more advanced feature can be implemented to bypass PHP in the case that the PHP code is not optimized both on Apache and Nginx servers. You can read more about this on our Cache Enabler support page.

Clearing Cache

There are three ways you can clear your cache with Cache Enabler.

  1. In the settings page of the plugin if you hit “Save Changes” it will clear the cache.
  2. You can also click the “Clear Cache” up on your WordPress admin bar.
    wordpress clear cache
  3. In version 1.1.0 an individual “Clear URL Cache” was also added so that you can clear specific pages and or custom post archives.

Summary

Let us know what you think of Cache Enabler in the comments below. From caching to disk, to minification, a focus on HTTP/2 and serving up WebP images, you can see drastic speed improvements without any complex setup. Combined with our other plugins, CDN Enabler and Optimus, we hope to further speed up your content delivery in WordPress!

Related Articles

Free WordPress Cache Enabler Plugin was last modified: April 10th, 2017 by Brian Jackson
  • Nils

    Hi,
    I have tried your plugin and would really like to use it since I have only heard good things about it, but for some reason the subjective page loading time is much higher than when I use the plugin “cachify”. On webpagetest.org page loading is about the same with Cachify and your plugin, but subjectively teh pages take much longer when I use Cache Enabler…what could be the reason for this?

    • Thanks for your comment Nils! Have you confirmed in the source code that the cache has been built up before testing? Depending on the size of your site, sometimes it can take a few minutes to build up the cache. Also, you can see advanced snippets here if PHP isn’t optimized on your server: https://www.keycdn.com/support/wordpress-cache-enabler-plugin/

      • Nils

        Hello Brian, thank you very much for your reply! I added the code to my .htaccess and indeed webpagetest gives better results and subjectively page loading is also better. When I used cachify, I needed to add this to my htaccess:

        # BEGINN CACHIFY

        # ENGINE ON
        RewriteEngine On

        # GZIP FILE

        RewriteCond %{REQUEST_URI} /$
        RewriteCond %{REQUEST_URI} !^/wp-admin/.*
        RewriteCond %{REQUEST_METHOD} !=POST
        RewriteCond %{QUERY_STRING} =””
        RewriteCond %{HTTP_COOKIE} !(wp-postpass|wordpress_logged_in|comment_author)_
        RewriteCond %{HTTP:Accept-Encoding} gzip
        RewriteCond %{DOCUMENT_ROOT}/wp-content/cache/cachify/%{HTTP_HOST}%{REQUEST_URI}index.html.gz -f
        RewriteRule ^(.*) /wp-content/cache/cachify/%{HTTP_HOST}%{REQUEST_URI}index.html.gz [L]

        AddType text/html .gz
        AddEncoding gzip .gz

        # HTML FILE
        RewriteCond %{REQUEST_URI} /$
        RewriteCond %{REQUEST_URI} !^/wp-admin/.*
        RewriteCond %{REQUEST_METHOD} !=POST
        RewriteCond %{QUERY_STRING} =””
        RewriteCond %{HTTP_COOKIE} !(wp-postpass|wordpress_logged_in|comment_author)_
        RewriteCond %{DOCUMENT_ROOT}/wp-content/cache/cachify/%{HTTP_HOST}%{REQUEST_URI}index.html -f
        RewriteRule ^(.*) /wp-content/cache/cachify/%{HTTP_HOST}%{REQUEST_URI}index.html [L]

        # END CACHIFY

        Is this the same? Also, do I need to add all the code that you are mentioning? Because I am not using the WebP option and don’t have https/2.

        • The rules for Cachify and Cache Enabler are very similar, however the directories are different for the rewrite rules based on the plugin. I would leave the WebP lines in, just in case you ever start using WebP. You can disable the WebP option in the plugin settings and then it won’t create a 2nd cached file for serving WebP format.

          • Nils

            Thank you. I noticed under the Cache Enabler stamp in the source code there is (gzip), does this mean I can leave out the html part of the htaccess?

          • Hi Nils, I would leave that in your .htaccess file.

        • Hi Nils, please make sure to use the latest version (1.0.4) and use the latest .htaccess snippet -> https://www.keycdn.com/support/wordpress-cache-enabler-plugin/ to actually bypass PHP if a static HTML file is available. This approach is a bit faster but it requires config in the .htaccess file.

  • Rick Dees

    How would this work if I am already using memcache, Zend Opcache and redis a the webserver. Also, what if I am already using ngx-pagespeed with WebP enabled, plus CSS and JS minification and concatenation?

    I am trying to figure out if KeyCDN can help me since I already covering a lot on the server level

  • Hi, thanks for great plugin. I’m using this plugin on my site because I use Redis Cache on EasyEngine so I can’t use W3 Total Cache.
    But, can you add a feature that support multiple CDN hostname? it will be great.
    Thanks!

    • Hi Phạm,
      The problem with that is with the new HTTP/2 protocol domain sharding (splitting up requests across multiple domains/subdomains) actually hurts performance.

  • sounds awesome. would like to see more options for membership sites and ecom sites. we have loggedin users all the time to watch courses [we use WC + Groups plugin to manage access to restricted pages for customers]. would be good to have seaparate cache per user option, as with zencache pro or wp rocket.

  • Hi, does Cache Enable support Memcached?

    • The Cache Enabler stores the HTML docs on the disk. You can use a ram disk to have it even faster. Something like this:

      mount -t tmpfs -o size=1024M tmpfs /path/to/wordpress/wp-content/cache/

      Based on our tests is this approach faster than memcached. So the Cache Enabler does not support memcached natively.

  • Have you done any comparisons with JPEGmini?

    • We have not yet, I have made a task to run some tests. Here is a decent comparison: http://txt.arboreus.com/post/10361830233/jpegmini-vs-gimp-jpeg-vs-webp WebP turned out to be slightly smaller in file size but then the quality looks very different compared to JPEGmini. At that point it almost comes down to personal preference for quality. Will make interesting case study :) Thanks for your comment.

  • Daveak “Old Man Roshi” Carter

    Hello, quick question I am running WordPress/Woocommerce and using KeyCDN for my CDN provider. I am also using Opcache for Debian 8 and needed to find out if using this WordPress Cache Enabler is beneficial with Opcache? Please let me know if this plugin would increase productivity having Opcache enabled. Thank you.

    • Sebastian

      Opcache and cache enabler do different things. Opcache will optimize your PHP execution and response times, improving your servers’ response times. Cache enabler will create static versions of what PHP now outputs faster, enabling a CDN to go in and cache your content that would otherwise be created dynamically.
      It’s not quite as black and white but likely you’ll benefit from having both.

  • Hey thank you guys for this plugin that I have find so long in the past! :D Nice

Share This