Is caching my problem? Views not refreshing for logged out users

By: JK Tor | Asked: 08/02/2024
ForumsCategory: General questionsIs caching my problem? Views not refreshing for logged out users
JK Tor asked 4 months ago
I am using a view as a way to generate a header that has a different random picture. It's a simple view that shows a single field (an uploaded picture in this case) with a random sort. When I'm logged in, this header shows a different picture on each page load. When I'm not logged in, the view stays stuck on a single picture even though the view has technically changed. I suspect that when I'm not logged in, I am pulling a cached version and therefore the picture never changes. This is not a huge deal in this particular situation. I just wonder if caching is the issue and if the behaviour would be the same for a different view that had more important information that changed frequently. As always, thanks for your help and I really appreciate this resource!!
1 Answers
Victor Font answered 4 months ago
You're using a view as a header image? That's innovative. Is the "Limit form visibility" option checked on the Form Permissions settings screen?
JK Tor replied 4 months ago

Hi Victor, thanks for the response! Yeah, I didn’t want to pay for another random image plugin lol. The other good thing is that I can keep some text that I display with the image as another field too. I don’t have the “Limit Form Visibility” checked for the image upload form. I don’t think there is a View Permission option on the view, is this correct?

Victor Font replied 4 months ago

I'm not aware of any permissions that would prevent a view from displaying. Do you have any view filters activated?

JK Tor replied 4 months ago

Hi Victor, no filters on the view.

I was able to do more testing this evening. I'm using Cloudways that uses Varnish (outside WordPress) and the Breeze plugin by default.

When I disable both, the header images randomly rotate. However, if either (or both) are enabled, only one image is cached and displayed. The Varnish cache lifetime is set to 4 hours, so a new image would be pulled after this time.

Cloudways doesn't recommend turning off caching so I'll have to decide how important this is. I will also have a table on the front page (another view) that will list recent uploads and reviews submitted to the site. This form view will also only refresh every four hours for non-logged in users.

The decision for me is balancing the performance impact of not caching versus showing stale data to non-logged in users. The site really caters to users that are logged in, so I may just have to accept that the info on the front page will lag up to four hours.

Thanks for your help.

Making the Best WordPress Plugin even better - Together

Take on bigger projects with confidence knowing you have access to an entire community of Formidable Experts and Professionals who have your back when the going gets tough. You got this!
Join the community
crossarrow-right