Hard-coded blocks and cache
Permalink
Here's a question I asked in Totally Random stream on February 10th:
----------
If I hard-code blocks to template, will they get cached just like "normal" blocks added to areas?
----------
There wasn't an definite answer available at the moment, so maybe we can continue discussion here. The caching question is not really critical one, but I just wanted to ask it considering site performance.
----------
If I hard-code blocks to template, will they get cached just like "normal" blocks added to areas?
----------
There wasn't an definite answer available at the moment, so maybe we can continue discussion here. The caching question is not really critical one, but I just wanted to ask it considering site performance.
This is actually very interesting. IconicSchema brought up a great point on IRC regarding using a hard-coded autonav block in a site with a large sitemap where you are doing page data gathering (for images/attributes/whatnot) and how this would severely hamper the speed of every page on that site as a result.
Great question, Ale; this is going to actually cause me to change some methodology with site-building to speed things up a bit. It sounds like hard-coding a stack is probably the best way to go.
Great question, Ale; this is going to actually cause me to change some methodology with site-building to speed things up a bit. It sounds like hard-coding a stack is probably the best way to go.
Thanks for taking the time to explain the methods.
Previously I've used the Block::getByName() quite much, but usually set up some navigations directly to the template (the getByHandle()... method). For now on, I think I'll set all of them up to Scrapbooks/Stacks for better performance.
Previously I've used the Block::getByName() quite much, but usually set up some navigations directly to the template (the getByHandle()... method). For now on, I think I'll set all of them up to Scrapbooks/Stacks for better performance.
Hi Andrew,
Sorry to necro a year-old thread but is this still the case with the new caching mechanisms in 5.6.1?
Sorry to necro a year-old thread but is this still the case with the new caching mechanisms in 5.6.1?
Hello Andrew
Is this still the case that hardcoded blocks are not cached after implementing the new cache mechanism in 5.6.1?
Thanks for a short statement on this.
best regards, Roland
Is this still the case that hardcoded blocks are not cached after implementing the new cache mechanism in 5.6.1?
Thanks for a short statement on this.
best regards, Roland
Blocks now seem to be cached but I would also like an update on that.
or
It should cache, because you're dealing with real block objects you've defined in a stack or a scrapbook (pre 5.5) somewhere. If you hard-code the block like this:
There will be no caching, because there has to actually be a block object stored in the database somewhere for caching to work.