The WinCache effect: Save with object caching

Date posted: 2016-10-09
Last updated: 2026-10-03

WinCache's object cache backend for WordPress on IIS cut the number of database queries per page from 31 to 12 and lowered the page generation time.

WinCache, or Windows Cache Extension for PHP, is a PHP accelerator that is used to significantly increase the speed of PHP applications running on Windows Server IIS. Besides increasing the speed of PHP applications, WinCache decreases CPU usage, making it a win-win extension. This post is about WinCache's advantages for WordPress on Windows Server IIS. I've described how to run PHP with WinCache on IIS in an earlier post.

WinCache alone speeds up PHP, but WordPress still runs all its database queries. Dropping the WinCache Object Cache Backend object-cache.php file into wp-content/ gives WordPress a persistent, memory-based object cache, which saved some 19 of 31 queries per page load on a vanilla site.

I originally wrote this post in 2016, for PHP 7.0. WinCache is no longer developed and there are no builds for current PHP versions. The idea of a persistent object cache for WordPress is as valuable as ever though: today you would use an object cache drop-in for Redis or Memcached.

Measure the effect of WinCache

Once you've set up and configured WinCache, it's used by your IIS web server and PHP, increasing website speed and decreasing CPU usage. You can benchmark and measure its effect.

The PHP loading time and MySQL query statistics in the footer of a WordPress site might show:

Stats: 31 queries in 0.914 seconds, running PHP version 7.0.4 & Wincache
Stats: 34 queries in 0.381 seconds, running PHP version 7.0.4 & Wincache
Stats: 31 queries in 0.162 seconds, running PHP version 7.0.4 & Wincache
Stats: 31 queries in 0.149 seconds, running PHP version 7.0.4 & Wincache

Pretty good, but still 31 queries for a vanilla WordPress site with only a few plugins.

WinCache Object Cache Backend for WordPress

To effectively use WinCache, there is a drop-in plugin available: WinCache Object Cache Backend. You can drop its object-cache.php file in your wp-content/ folder, to utilize WinCache's object cache mode: a persistent memory-based backend for the WordPress object cache.

Now let's look at the statistics:

Stats: 12 queries in 0.149 seconds, running PHP version 7.0.4 & Wincache
Stats: 12 queries in 0.125 seconds, running PHP version 7.0.4 & Wincache
Stats: 12 queries in 0.124 seconds, running PHP version 7.0.4 & Wincache
Stats: 12 queries in 0.126 seconds, running PHP version 7.0.4 & Wincache

WinCache's object cache is where WordPress and WordPress plugins store the results of complex operations. On subsequent loads, the data can be fetched from the cache (memory), which is much faster than dynamically generating it on every page load. In this case, saving some 19 queries.

Using Redis as object cache? Here is how to automatically flush the Redis cache after publishing a WordPress post. And you can use WinCache's user cache for your own code too: cache MySQL query results with PHP WinCache.

This post is part of my IIS administration & hardening guide.

I write these posts in my spare time, based on real problems from my day job as a sysadmin. If this one saved you some debugging time, a small donation is much appreciated. Thanks! 🙏

Leave a Comment