• Resolved nick6352683

    (@nick6352683)


    Is there a way to manage what objects not to be cached?

    For example I have an ACF Block which displays randomly an image from a number of images submitted by the web designer. The script gets the url of the random image and displays it on the site. Of course when the page is cached, the php script is executed just the first time during the cache generation, so you always get the same image.

    Is there a way to tell Rapid Cache not to cache a certain Gutenberg Block for example?

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author MegaOptim

    (@megaoptim)

    Hello,

    I know this is old question, but let me answer it, so in case anyone still needs help on this issue.

    To answer your question. This is not possible. Certain objects or widgets can not be excluded from caching because the whole page is stored into the cache.

    The most you can make is to hook into dynamic version salt filters and adjust the cache expiration based on your needs for specific page or based on specific condition.

    https://github.com/megaoptim/rapid-cache/wiki/Dynamic-Version-Salts

    Best Regards,
    Darko`

    dimal

    (@dimalifragis)

    @megaoptim Litespeed cache (free) does offer that option, to exclude widgets from caching.

    Also Fastest Cache PRO (paid) offers that.

    Both are using mod_rewrite for serving, you use php. Is that a block?

    Thanks

    dimal

    (@dimalifragis)

    @nick6352683 If you want NOT to cache widgets, there is a great small plugin here to Ajaxize a widget IF it supports shortcodes.

    Thread Starter nick6352683

    (@nick6352683)

    @dimalifragis thanks for your suggestions, I will definitely check them out.

    Thread Starter nick6352683

    (@nick6352683)

    … and yes, I am trying not to cache certain ACF blocks, for this reason.

    Some of my blocks are given an array of images, that with php a random one is picked and it’s url is returned. Therefore with every page load a different image is to be displayed. When I apply caching to the page, the cache plugin creates a static html code for the site and keeps displaying the html code until the cache expires and generates a new one, resulting in displaying the same image with every page load, until the cache expires, and a new one is created.

    Ultimately I need to find a cache plugin (if such exists) to indicate on a block basis not to be cached, so in my case, for the images, I can have a randomly generated image with each page load, while the rest of the page will be cached.

    Plugin Author MegaOptim

    (@megaoptim)

    Excluding certain objects from the page itself will have massive performance hit and that is not the goal of this plugin.

    As @dimalifragis mentioned you can try loading the dynamic results with ajax.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Don’t cache certain objects?’ is closed to new replies.