Web- Notes for HW site

WordPress how-tos and config info specific to Headwaters Economics.

WP Engine server caching

A site visitor’s browser caches content locally so once download the file can be retrieved from the user’s harddrive rather than re-loaded. Servers can also do a different kind of caching to deliver content to users more efficiently.

Page Caching

Normally, when the user requests an URL, the web server gets content Headwater’s WordPress database, then uses our plugins, theme, and scripts to assemble and deliver an HTML file to the user’s browser (browser display HTML). A Page Cache saves that HTML for the next request of that same URL and delivers that — faster and more efficiently because the server doesn’t re-access the database and files then re-assemble the HTML.

Logged-in users don’t get cached versions.

Staging environment doesn’t serve cached versions.

Hitting the Publish button purges the cache for that post.

Admin users can purge the entire site’s cache.

Page cache expires in 10 minutes (benefits only the most active pages).

Changes made outside of WordPress, like via SFTP, do not purge the cache.

All our registered scripts and stylesheets have “cache-busting” URLs, a new value in the query string that servers (and browsers) see as a different resource. We do that by adding the file-modification timestamp as the version:
https://headwaterseconomics.org/wp-content/plugins/he-interactives/js/he-inter-common.js?ver=1479531278

You can do that manually by incrementing a value (like: “x=1“, “x=1b“, etc.). Tested that in the Postscript box of a post:
https://headwaterseconomics.org/wp-content/plugins/he-interactives/apps/timber-cut-sold-2015/style.css?x=1

Object Caching

WP Engine also caches the results (called “objects”) of queries made to the database, either by a user (e.g, a term search) or by our theme/plugins.

The next time there’s that identical query (like the same search term), the server fetches the cached results rather then rerun the query. The cache saves a fixed amount of objects, purging the ones not used for the longest time.