Image Slider Custom Template and Caching

Permalink
I have created a custom template for the Image slider block which randomises the slides and displays the first four slides only.

if(count($rows) > 0) {
  shuffle($rows);
  $rows = array_slice($rows, 0, 4);
}


This works perfectly whilst I am logged in as refreshing the page randomises the slider each time. Once I have logged out however, the same slides always show up and in the same order.

I am using Concrete5.7.5.13 and I have switched off caching for the page in question which shows as "not currently in the full page cache" when I check the Page Settings. I have also removed all other versions of the page so the same version is being viewed by everyone.

This appears to be the cache not operating as expected as when I empty the cache completely the order does change but then persists again until I empty the cache again. I have tried adding some test text to the Custom Template file which again will display immediately whilst logged in but will only display for other users after I have emptied the cache.

Any advice on mastering the caching would be greatly appreciated.

 
phowie74 replied on at Permalink Reply
I appear to have stumbled upon a solution.

After trying to change the page caching settings to clear the cache regularly (with no success) I decided to look at the block settings themselves.

With the page in Edit Mode I clicked on the Image Slider block and chose the Advanced option. I ticked the box to Override block type cache settings and put a very short cache expiry time.

The Image Slider block now functions the same on the live site and in edit mode displaying random slides as expected.