Websites constantly publishing information demand many resources, especially from the database server.
Properly configuring the server cache is crucial to ensuring performance. Finding the correct strategy can be challenging.
Index
- No one likes waiting, especially for news
- Identify where you will show your fresh content
- Identify how you will print your fresh content
- How often should you purge the cache?
- Let’s talk about getting caching right
No one likes waiting, especially for news
News websites must push their readers a balance between the latest, the featured, the related, and the sponsored content.
The page load time for this puzzle must be fast, or users will move on to other sites, including search engines.
Not everything can be forever cached to increase speed. In this competitive world, content frozen in time makes no sense.
Websites compete with other websites, AI results, and social networks, which have understood that freshness is everything.
Content is still king but must be delivered properly.
Heavy site traffic websites without caches can consume all server resources until they crash or cause the user to wait a long time in the queue.
CDNs can help resource usage, but big websites must have a server cache strategy.
Identify where you will show your fresh content
The homepage is the most traditional page to start with this strategy. Usually, it will show glimpses of the latest information from every section.
Category archives will work similarly, filtering to narrow searches and dig deeper.
But here is the reality. Due to the traffic volume, the most effective place to show fresh content is in the full view of a story. In CMS like WordPress, this is called a single post template.
While a story develops, you should include related news in parts of your post.
Traditionally, related information can be included between the paragraphs as lists or at the bottom. Featured images are usually included to increase engagement.
When you update a story, it will flush that specific post’s cache.
The idea is not to empty all of your website’s cache every time something changes, as this could even take your site down, but only the relevant content that is related.
Identify how you will print your fresh content
How do you define related content? Usually, you use associated terms, such as tags, categories, or custom lists of posts.
That way, you don’t have to purge specific content manually; you can let the system do the work for you.
Template parts like the header or footer are inserted globally. Similarly, you could define blocks that are synced across your website. These can be great for internal ads or related content lists.
The game’s name is the high cache ratio. The higher the ratio, the faster the response will be.
Now, for the most traditional blocks, let’s say you have one showing your latest posts in the sidebar of all your posts.
If you use regular PHP or server-side processing for this function, you must frequently purge the cache to get the latest version sitewide.
Using client-side technologies like AJAX to keep this content fresh could work, or injecting it like an advertisement.
But what if the user has an ad blocker enabled?
Using the server-side approach is better to ensure everyone sees the same.
Without AJAX, you could, for example, limit clearing the cache to the latest or most visited posts so the performance doesn’t decay too much.
Or, you could use object caching to purge specific queries instead of all your site’s cache. Object caching is designed to store and serve commonly used queries efficiently to ensure smooth rebuilding. It is especially powerful for websites that mostly use static information, such as News websites.
How often should you purge the cache?
It depends on the website. I’ll consider these questions:
- How often do you publish new posts? It doesn’t make sense to purge the cache if nothing changes. If the information constantly changes, does it make sense even to cache it? Generally, it doesn’t, but how often is sometimes a matter of testing.
- Is the website struggling to rebuild the cache? Giving the cache more time to be used can help. Consider upgrading the server-allocated resources, improving your code, and updating the server’s software. Your server shouldn’t struggle to build the cache. To deliver a consistent experience or increase the resources, consider pre-loading the cache when the traffic is low.
- What types of cache are you generating? It may be time to reconsider whether you need a mobile-specific cache or additional versions like AMP. Is merging assets helping? HTTP2/3 can deliver them asynchronously, removing processes. Review who generates the cache. Is it a plugin? Can the server handle it directly? Sometimes, It’s not a matter of how often, but if you can avoid layers of complexity.
Let’s talk about getting caching right
After years of building websites, especially for high-traffic projects like news sites, one thing has become clear: caching can make or break the experience. I’ve seen sites soar with the right strategy and struggle when caching was overlooked. It’s not just about speed; it’s about keeping readers happy and your site running smoothly.
The key is finding what works for your specific needs. There’s no universal formula, but you can start by asking the right questions: How often do you update content? Which parts of your site need to feel fresh? What’s your server’s breaking point? From there, it’s all about fine-tuning—using technology like object caching, targeting specific areas for purging, and testing what keeps things fast without compromising freshness.
Trust me, it’s worth the effort. When your cache is dialed in, your site feels alive—fresh, fast, and ready for anything. Whether it’s the latest news or a popular story gaining traction, you can confidently deliver content that keeps readers returning for more.
So don’t overthink it, but don’t ignore it either. A little time spent on caching today will save you many headaches tomorrow. And if you’re ever unsure, remember: caching isn’t a magic fix; it’s part of the craft. And with a little trial and error, you’ll find your sweet spot.
Jos Velasco.
CC0 licensed photo by Jose Lazo from the WordPress Photo Directory.
Leave a Reply