Block caching

Permalink
Block caching is quite well explained under

API
https://documentation.concrete5.org/developers/working-with-blocks/c...

CMS
https://documentation.concrete5.org/editors/dashboard/system-and-mai...

I'm somewhat unclear though if that means, that Block caching is only activated at all if in the CMS the block cache is activated and only then is it relevant what options are given in the PHP code, or if the config in the PHP code in the blocks is superseding any setting in the CMS.

Basically... if I activate block caching in a block, do I also need to activate it in the CMS to make it work? I guess the answer is yes?

And almost more important: Can Single Pages use these parameters and also profit from block caching?

 
JohntheFish replied on at Permalink Reply
JohntheFish
> Block caching is only activated at all if in the CMS the block cache is activated and only then is it relevant what options are given in the PHP code

Is how it works. The dashboard settings enable the block cache. Block controller settings decide how a block is cached when the block cache is enabled. Advanced block settings menu then gives you a chance to override a block controller's settings.
JohntheFish replied on at Permalink Reply
JohntheFish
Second part, single pages.

Any block that is edited/viewed through a page area or stack can be cached, including page areas within single pages and blocks in stacks that have been hard coded into a page..

Blocks hard-coded directly into a page are not cached (but there is an addon by a3020 that can cache hard coded blocks).
Kiesel replied on at Permalink Reply
I think I mean it the opposite way. I mean, if Single Pages themselves can be cached.

Can I attach the same code to manage block caching to e.g.: application/controllers/single_page/mysinglepage.php and it will cache the contents of this page?
JohntheFish replied on at Permalink Reply
JohntheFish
No. Block cache is for blocks only.

If you put similar properties in a single page controller, they will be completely ignored.
Kiesel replied on at Permalink Reply
Thank you! Any way I can cache those pages?
JohntheFish replied on at Permalink Reply
JohntheFish
Generally with single pages you don't want them cached. You would probably need to use an external cache system and configure it to handle paths that include the base of the single page.

Usually this problem is the other way round. Site owners ask why their single pages don't work and it turns out they had a cache in front of it that needs to be disabled :-)
Kiesel replied on at Permalink Reply
Thanks for that one, so works like I thought, that's great.