Caching Expensive Queries the Simple Way
Most caching bugs come from invalidation. This pattern keeps invalidation in one place so it is hard to get wrong.
Reading work aloud is the cheapest editing tool there is. Your ear catches rhythm problems that your eye skips over, especially in long sentences.
function quill_remember( string $key, callable $producer, int $ttl = HOUR_IN_SECONDS ) {
$value = wp_cache_get( $key, 'quill' );
if ( false !== $value ) {
return $value;
}
$value = $producer();
wp_cache_set( $key, $value, 'quill', $ttl );
return $value;
}
Good tools disappear. The ones we keep are the ones we stop noticing, because they do exactly what we expect every single time.
We keep a running document of things that went wrong on past projects. It is not a list of failures so much as a list of warnings, and we read it before every kickoff.
Deadlines help, but only when they are real. A deadline that everyone knows will slip is just a date on a calendar.
Related posts
Lazy-Loading Images Without a Library
Native loading hints, a sizes attribute, and one fallback.
Finding Slow Pages with a Single SQL Query
Group request logs by path and sort by the ninety-fifth percentile.
Measuring Largest Contentful Paint in the Field
A PerformanceObserver snippet you can paste into any page.
Comments · 0