Good afternoon all…
Longtime CloudFlare customer.
Question: I would like to embed my Twitter feed on my VPS and take advantage of CloudFlare caching…
The feed is a combo feed (Twitter Lists) and they update minute by minute…
Is there a way I can leverage CloudFlare caching, but instead of purging every hour, purge every 10 minutes?
Twitter feeds are often just an embedded feed straight from Twitter.
By default, Cloudflare does not cache HTML, as that’s not typically resource-intensive. Just static content like images, CSS, and .js. To cache HTML, you’d have to add a special Page Rule.
If the Twitter content indeed comes from your domain, and you’re trying to cache HTML, the minimum Edge Cache TTL for most free plans is 2 hours.
So I am assuming if I get a ton of traffic… even on my cheap VPS… I should be good, yes?
Your cheap VPS will certainly perform better with Cloudflare. If you post your domain name, we can give a better-informed opinion.
That page is nicely lightweight. The static files cache well, and the HTML is fantastically compact.
- You could even have Cloudflare cache the twitter.php HTML, which would lighten the load even more, but it’s best left alone for now.
- The bigger concern is Matomo. If your site gets hammered, and you’re collecting stats with Matomo, that might strain your server. That’s the part you’ll have to keep an eye on, and Cloudflare caching can’t help with.
I appreciate the kudos… I worked hard on keeping it lightweight.
I know about the issue with my tracking and will remove it.
My main concern is the “Reddit” effect. I expect lots of traffic at once. Back to my original question… how can I setup CloudFlare on this page to update every 10 minutes or so? Can you point me in the right direction (tutorial) for this? I know just enough about this stuff to be dangerous (but my main skill is advertising).
The only thing that updates on that page is the Twitter feed, and that’s not part of your domain. It comes straight from Twitter in realtime.
Other than the Twitter feed, is there anything else on that page that changes?
Nope. Nothing changes except Twitter feed.
Then there’s no need for a 10 minute refresh. If you want to cache your page’s lightweight HTML that’s served from your domain, you can add a Page Rule:
Match: Markus Allen - homeschool for all ages!
Settings: Cache Level (Cache Everything), Edge Cache TTL (2 Hours)
I super appreciate your replies sdayman…
With that said:
The audience I am targeting are glued to the news. They want to be the first to discover news stuff on Twitter. This is why I was hoping to have the freshest content (within 10 minutes posted on Twitter)… does it make more sense for me not to cache?
Your page is just a window frame for the twitter feed. Like a window frame, you can’t freeze what’s going on outside the window. It’s always changing.
But if you want to make your window frame stronger, cache it. The scene outside won’t be affected either way, but it would suck if the frame breaks and ruins the view.
Thank you sdayman. I REALLY appreciate your help on this!
This topic was automatically closed after 14 days. New replies are no longer allowed.