Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Switch from central list to per-url hash. This removes the need to know about and remember updating a central list. I noticed one file missing already, namely the typesense-minibar.js file.
This slightly improves cache use by not invalidating them all together.
The filemtime timestamp values are so short that an MD5 hash of three filemtime() values is actually longer than just the three numbers concatenated. This means we lack the benefit a hash usually provides, which is that you get exposure to high entropy input in a format shorter than that same input.
Switch from mtime (or mtime-hash) to content-hash. This has a few benefits:
Note that Git does not track modified times. Instead, mtime is whenever a
git clone
,checkout
orpull
last created or modified the file locally on that server. For example, if yougit checkout OLD
and then back togit checkout main
, the files get a newer mtime. This is what happens by default at the OS level. Git isn't setting these mtime values.This means the URL ends up alternating depending on which server (e.g. wp-04 and wp-05) last generated the page. It also means different pages on the site may have a different URLs for the same asset, thus making ineffective use of caching. If the site was statically generated in CI, it would bump the cache after every commit instead of only when that file has changed, because in CI the "git clone" woulld create/modify all files at that time.
It is the same between local, staging, and production, which might ease debugging in some cases.
It allows continuing and re-using old browser (and CDN) caches if a commit is rolled back for some reason, since it would literally be the same content and thus URL again.
Follows-up 2015fcb.
Ref #469 Ref #468