Jump to content

4.x custom block caching


Recommended Posts

Getting ready to convert a 3.x site.  I have a custom block that generates a single image from the top 50 poster images using php.  That image is then displayed on the main page. 

I use a custom block with a cache time of 1 day so that the image gets generated every 24 hours because it uses feeds of user images and combines them with php graphic processing into a single image. 

So far I have not found an ability to set cache time for custom blocks in 4.x.  Am I missing something or any ideas on other ways?


Link to comment
Share on other sites

So at this point looks like one way to deal with a non-cached block to be "updated" every 24 hours or so is to use IPS\Data\Store for a date flag. 

If the current date is after the flag date then set the flag to today's date and run the block code.  The amount of code run in the block could be reduced further by checking the time and only moving on to check the flag in early morning hours.  There is a slight chance a race with multiple page loads at "same time" but my code would just run an extra time.

Of course I could write a plug-in, but really did not want learn the "new-way" at this point.


Link to comment
Share on other sites


This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...