New: Learn Statamic on Laracasts!

We've retired the forum in favor of GitHub Discussions.

New conversations can be started on GitHub. Existing conversations will remain for a while longer.

Head over to GitHub →

Way to circumvent the cacheing of a random take of entries from a collection

Richard Verbruggen January 30, 2021 by Richard Verbruggen

I've got a page which displays content of a collection of reviews. It takes random 5 reviews and displays them:

{{ collection:reviews sort="random" limit="5" }}
{{ /collection:reviews }}

Works great! But I want to use the alf (or even full) cacheing strength of Statamic. And obviously it wont randomize on subsequent loads of the page as the static cache will be shown.

Is there a way to circumvent this? So it reloads only that portion? But that looks impossible due to the nature of the caching strategy.

Or; is it strange to set a schedule to recache the page every 1hr or something?

Answered by Erin Dalzell!
>>>>>>> Answered <<<<<<<
2 Replies