Jump to content

Block Caching?


Go to solution Solved by TDBF,

Recommended Posts

Posted (edited)

The docs say:

Quote

 

Block caching

Custom blocks can optionally be cached, meaning the resources required to render the block are reduced. If your block is dynamic in any way (such as rendering differently based on the user viewing it, or the page it is being shown on), you should ensure that caching is not used.

 

I can't find any setting that actually has to do with block caching? These docs say I should ensure that caching for blocks is off but doesn't actually say how to do that. Is this the same caching setting as "cache page output for guests?"

I have a custom block that iterates over database records (a feed block) but it doesn't update immediately upon refresh when the underlying record changes. I'm assuming this is caching-related but I can't find any resources on manually handling this for plugin blocks.

Thank you in advance for any insight you can provide!

Edited by Hypervisor
Posted (edited)
1 hour ago, Hypervisor said:

The docs say:

I can't find any setting that actually has to do with block caching? These docs say I should ensure that caching for blocks is off but doesn't actually say how to do that. Is this the same caching setting as "cache page output for guests?"

I have a custom block that iterates over database records (a feed block) but it doesn't update immediately upon refresh when the underlying record changes. I'm assuming this is caching-related but I can't find any resources on manually handling this for plugin blocks.

Thank you in advance for any insight you can provide!

You will find block cache settings in the AdminCP, System/Settings/Advanced Configuration under the 'Server Environment' tab and then look for Performance. You will see 'Cache sidebar, header and footer blocks' settings.

However, you cannot turn block settings off, but you can bring it down to 1 minute.

Edited by TDBF
  • Solution
Posted
7 hours ago, Yamamura said:

 

You mean when you create a Page block?

Yes there are some instances where you can cache a block, and these are normally with 'custom' page block, and will be found on the content tab underneath the editor window.

Like this:

image.thumb.png.c18b09199b94613296cadf205f43aa85.png

Posted (edited)
On 9/20/2021 at 2:52 AM, Marc Stridgen said:

The selection on whether or not to cache a block is when you create a custom block with custom content, and create this from the admin CP. You will not see this on standard blocks you add on the front end of the site

Hi Marc,

Sorry I didn't link the docs! What Yamamura linked to is correct (specifically the bottom paragraph).

Given that the block I'm using is a Feed Block, is it supposed to not always be in sync with the DB records it's showing due to the caching? If I change the field on a record, it will only update after a certain amount of time or if I go to System -> Clear System Caches. Interestingly enough however, another block that comes from a plugin the same exact template updates immediately (it's in the forum header and not the body, so not sure if that makes a difference).

Thanks!

Edited by Hypervisor
  • Recently Browsing   0 members

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