0

I have some PHP logic in a template that randomly loads some content. Logged in, this works great. Logged out, caching prevents different content from being loaded each refresh.

Is there a good way around this, aside from excluding the particular page from cache (in my case, Varnish)? All clever solutions welcome.

2
  • 2
    Well the whole point of the cache is to prevent the page being needlessly regenerated each refresh. If the content is updated frequently enough that this is a problem then you should just not cache that page. The alternative would be to load the content in dynamically after the page has loaded with AJAX. May 3 '19 at 1:59
  • Yeah, that makes sense @JacobPeattie -- I ended up loading all of the content with inline styles hiding them all, then used JS to display one at random.
    – brackfost
    May 7 '19 at 15:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.