The difference that ProCache makes is astounding!
ProCache provides the ultimate performance for your website by completely bypassing PHP and MySQL and enabling your web server to deliver pages of your ProcessWire site as if they were static HTML files. In addition, ProCache provides built-in HTML, JS and CSS minification, CDN integration, and many other performance tweaks. ProCache is easy to use and configure–you don't need to know anything about web optimization, as ProCache takes care of it for you. ProCache is developed, maintained and supported by Ryan Cramer, lead developer of the ProcessWire core.
- ProCache is for Speed and SEO
- ProCache HTML Output Caching (XML or JSON too)
- ProCache CDN Support
- ProCache HTML Minification
- ProCache CSS and JS Minification and Merge
- ProCache Tweaks, Optimizations and Support
- Terms and Conditions
- Using ProCache
- ProCache API
- Further reading
ProCache is for Speed and SEO
An important part of search engine optimization (SEO) is ensuring that your site runs fast. Google doesn't like sending traffic to sites that take a long time to load or that are going to otherwise keep the user waiting, because it reflects poorly on the quality of their search results. For this reason, Google rewards sites that perform fast, sites that don't waste the time of visitors. Yet it takes a lot of expertise to optimize many aspects of your site for optimal performance. ProCache bridges the gap by providing the following:
A static cache of your page output, enabling pages to be delivered without PHP or MySQL. This results in mindblowingly fast "time to first byte" scores, and the difference is visible and obvious to not just search engines, but your visitors too. This is the original and most important feature of ProCache.
Support for integration with a CDN (content delivery network, such as Amazon's CloudFront or others). This enables you to offload delivery of your static assets like images, files, CSS and JS to a blazingly fast server that is regionally close to the visitor. It also greatly reduces the load on your main web server. This can make an unbelieveable difference in page delivery times, especially on image heavy pages. With ProCache, you can be up and running with a CDN in less than 5 minutes.
Minification and merging of CSS and JS assets, reducing the quantity of http requests necessary to load your web site. This likewise reduces the number of bytes sent from the server (meaning, faster page delivery).
Minification of HTML5 output, greatly reducing the number of bytes sent from the server and thereby speeding up page delivery. Our HTML minification engine is highly configurable, developed completely from scratch, and is the strongest and most effective HTML5 minification engine available.
Recommended tweaks and instructions to enable GZIP for output, management of your Apache cache-control headers, "keep alive" settings and more. Plus optional and automatic inclusion of canonical link tags in our output to ensure Google understands your output and never mistakes something as potential duplicate content.
These features are discussed in more detail in the sections below.
ProCache HTML Output Caching (XML or JSON too)
ProCache caches ProcessWire pages to static files, enabling them to be delivered by Apache without PHP or MySQL running. While ProCache now does a lot more than just caching, this feature remains the star of the show. The performance benefits are drastic and visible. Using ApacheBench with the homepage of the Skyscrapers site profile, we completed 500 requests (10 concurrent) to the homepage. The amount of time occupied to complete each of these was as follows:
- 29 seconds: no cache enabled
- 6 seconds: built-in cache enabled
- 0.017 seconds: ProCache enabled
These are typical results. As you can see, the performance benefits are huge. ProCache gives you the ability to drastically reduce server resources and exponentially increase the amount of traffic your server could handle. This is especially useful for traffic spikes.
Beyond measurements, ProCache makes your website feel faster to users, respond faster to search spiders (which can help with SEO), and helps to conserve server resources for requests that actually need PHP and MySQL. ProcessWire is already very fast, and not everybody necessarily needs what ProCache delivers. But regardless of whether you need it or not, there is little doubt that you can benefit greatly from ProCache.
ProCache CDN Support
ProCache HTML Minification
ProCache is able to significantly reduce the size of your HTML output, reducing the number of bytes sent between the server and the user, thereby increasing the speed of page delivery and render. It does all this while maintaining HTML5 standards compliance and without affecting the resulting visual appearance to the end user. We do this with our own original HTML minfication library that we've spent months developing and optimizing. We feel confident it is the best in the industry and most definitely worth your time! Read more about ProCache's HTML minification
ProCache CSS and JS Minification and Merge
ProCache's CSS and JS merge + minification makes a big difference for front end performance! ProCache will automatically identify all the CSS and JS references in your document and merge and minify them together. No code changes to your site are required, just check the box to enable and it takes care of it for you. Thoguh should you prefer it, ProCache also provides API-functions for merge/minify that you can use from your template files.
In support of reducing HTTP requests, it also identifies assets referenced from your CSS file(s) and base64 encode's them directly into the CSS file. This is mostly beneficial on smaller background images and such, and you can specify the maximum size it should encode in the ProCache settings.
As you would expect, any changes to your site's CSS or JS files are picked up automatically and re-merged and minified immediately, so that you don't have to pay any attention to what's happening behind the scenes.
ProCache Tweaks, Optimizations and Support
ProCache also comes with several other tweaks and optimizations that you can apply to your .htaccess file to improve the performance of your site. It helps you get up and running with GZIP, Apache cache control headers and more.
With ProCache you get one-on-one support and upgrades from the ProCache VIP board in the ProcessWire forums. ProCache is fully supported by Ryan Cramer, who also develops the ProcessWire core. If you ever need help with website performance and optimization, the ProCache VIP board is here for you!
ProCache provides the ultimate combination of tools for ProcessWire website performance. There's a reason this is our most popular Pro module! Give it a try and we think you'll agree that ProCache is the best performance tool out there, for ProcessWire, or any CMS for that matter!
- ProcessWire 2.6.0 or newer (ProCache 3.0)
- Apache web server or 100% compatible
Upgrades are made available through the ProcessWire ProCache support board in the ProcessWire forums (immediately visible upon purchase). If you can't see the support board there, please contact us or send a PM to ryan from the ProcessWire forums. Upgrades available within 1-year of purchase are free.
To install an upgrade you would typically just replace the old files with the new. However, there may be more to it, depending on the version. Always follow any instructions provided with the upgrade version in the support board.
Terms and Conditions
Your satisfaction with ProCache is guaranteed. If you find ProCache does not meet your needs and that you won't be able to use it, let us know within 7 days of purchase and we will refund your money in full.
Please do not copy or distribute ProCache, except on site(s) you have purchased it for. However, it is perfectly fine (and recommended) to make copies for use on staging, development or backup servers specific to the site(s) you purchased it for.
This service/software includes 1-year of support through the ProcessWire ProCache Support forum and/or email. If your access is not updated automatically, please notify us of your forum name so that we can upgrade your access to the members-only ProCache Support forum.
ProCache upgrades are free within 1-year of purchase. You may optionally renew your support and upgrades yearly by purchasing another copy of the same ProCache or using one of the reduced-cost renewal options presented in the store.
In no event shall Ryan Cramer Design, LLC or ProcessWire be liable for any special, indirect, consequential, exemplary, or incidental damages whatsoever, including, without limitation, damage for loss of business profits, business interruption, loss of business information, loss of goodwill, or other pecuniary loss whether based in contract, tort, negligence, strict liability, or otherwise, arising out of the use or inability to use ProcessWire ProCache, even if Ryan Cramer Design, LLC / ProcessWire has been advised of the possibility of such damages.
ProCache is provided "as-is" without warranty of any kind, either expressed or implied, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose. The entire risk as to the quality and performance of the program is with you. Should the program prove defective, you assume the cost of all necessary servicing, repair or correction. If within 7 days of purchase, you may request a full refund. Should you run into any trouble with ProCache, please email for support or visit the ProCache Support forum.
ProCache writes to your .htaccess file. It also removes any changes it makes if you uninstall ProCache. However, for good housekeeping, we recommend you also backup your .htaccess file if you have modified it from the default ProcessWire htaccess file.
- Copy the ProCache files into this directory: /site/modules/ProCache/
- In your ProcessWire admin, go to Modules and click "Refresh".
- Click "Install" for the ProCache module.
- Enter your product key in the field provided and 'submit'.
- Go to Setup > ProCache and configure your ProCache settings.
Up and running
ProCache runs for non logged-in guest users. ProCache is never running when you are logged-in, so you'll want to test the results from another browser. We like to use Chrome's "Incognito Mode" for this purpose.
After making changes on the ProCache configuration screen, if you don't see your changes reflected on the front-end of your site, be sure to clear the cache.
If you want to verify what pages are being cached, turn on the test/debug mode from the ProCache module config screen. This will make it add a line of text before your closing
</body> tag indicating when the page was cached. You will only see it on a cached page. If you know a page should be cached and you don't see it:
- Make sure you aren't logged in;
- Hit 'reload' in your browser;
- If you haven't cleared the cache since enabling test/debug mode, clear it.
If you are testing on localhost, or on another server where you have multiple ProcessWire installations, this may prevent ProCache from delivering cached pages to you. Clear your cookies, specifically one called "wire_challenge" and that should fix it. Or just open a Private or Incognito Mode window in your browser for testing.
ProCache can be used in combination with other caches, such as the built-in Page caching that you set per-template in the template editor. However, there isn't necessarily a reason to keep using it when you are using ProCache. To reduce confusion, we recommend you stop using the built-in page caching features when you are using ProCache. However, if you are currently using one of ProcessWire's built-in markup caching features like the $cache API variable or MarkupCache, you should continue to do so.
ProCache Maintenance (optional)
ProCache runs a maintenance task every 30-60 seconds to remove expired cache files. However, this maintenance is dependent upon the occurrence of non-cached pageviews. Since ProcessWire itself never actually runs when a cached page is displayed, it doesn't have the opportunity to run maintenance tasks. Most sites have some cached pages and some uncached pages, so this is not an issue. However, if most of your site's pages are cached, you should add a cron job to trigger maintenance. Otherwise your cached pages may take longer to expire than intended. Likewise, even if you just want the highest accuracy with regard to when cache files are expired, you might consider a cron job to trigger maintenance.
Your cron job may execute the following command every minute:
curl --data "procache=maintenance" http://domain.com/ > /dev/null
Replace "domain.com" above with your ProcessWire-powered site's URL, including the trailing slash (and subdirectory, if applicable).
Set this command to execute every minute or so. If you aren't too worried about being exact, every 5 minutes should also be fine. Worth noting is that we rarely use a cron job such as this in ProCache, as we find the built-in cache expiration behavior to be ideal for most cases.
ProCache provides a few public methods via the
$procache API variable that you might find useful.
ProCache Caching API
// Manually clear the entire cache $procache->clearAll();
// Manually clear the cache for a page $procache->clearPage($page);
// Return the number of cached pages $n = $procache->numCachedPages();
// Is the given page cached? Returns false if not, or array of // page info if yes: array('/path/to/page' => 'date cached') $info = $procache->pageInfo($page);
ProCache CSS/JS Minification API
$procache methods merge and minify the given files. Use of these methods is of course optional, as ProCache has the capability to auto-detect CSS and JS files and take care of it for you without any coding. But sometimes specifying the files yourself gives you the additional control that you may need.
Files may be specified as a PHP array or a CSV string. When given a relative URL, like shown in the examples below, files are assumed relative to the /site/templates/ directory. If that is not your need, then simplify specify the full non-relative URL to your assets. Do not include scheme like http or https.
// array of CSS files that you want to merge/minify $files = array( 'styles/main.css', 'styles/lightbox.css', 'styles/helpers.css', ); // output a <link> tag with merged/minified file echo $procache->link($files); // output your own <link> tag echo "<link rel=stylesheet type=text/css href=" . $procache->css($files) . " />"; // array of JS files that you want to merge minify $files = array( 'scripts/jquery.js', 'scripts/main.js', 'scripts/lightbox.js', ); // output a <script> tag with merged/minfied file echo $procache->script($files); // output your own <script> tag echo "<script src=" . $procache->js($files) ."></script>"; // just return merged URL to the given CSS or JS files (no minify) $file = $procache->merge($files);
Caching non-HTML content types
ProCache can cache and deliver other content types in addition html. For example, perhaps you want to cache an XML sitemap or a JSON feed with ProCache. Content types can be defined in your /site/config.php file like this (below is the default setting):
$config->contentTypes = array( 'html' => 'text/html', 'txt' => 'text/plain', 'json' => 'application/json', 'xml' => 'application/xml', );
The above setting represents the default as provided in /wire/config.php, so if the above is consistent with your needs then you do not need to set it up in /site/config.php.
If you do modify it, you may add as many other content types as you'd like. The array keys should represent the file extension defined by an Apache mime-type. The array values represent the content type header that ProcessWire sends before outputting the page.
Each template has one of the defined content types specified for it. This is specified by editing a template in the admin, by going to: Setup > Templates > [any-template] > Files > Content Types. Select which content type the template should output. If nothing is selected then PHP's default "text/html" content type is used.
Note that ProCache only uses the file extensions (array keys). In using those file extensions for the physical cache files, Apache recognizes them and sends the appropriate content-type headers just as ProcessWire does. This is what enables you to cache non-HTML content with ProCache, despite the fact that PHP is never loaded when the cached output is delivered.
ProcessWire ProCache is Copyright 2018 by Ryan Cramer Design, LLC
ProCache CDN IntegrationUsing ProCache with a CDN can drastically reduce the server’s overhead and bandwidth in delivering assets, while also greatly improving the speed at which they are delivered to end-users.