Bildy Engine is not slow, but to make sites really fly it uses built-in caching. This significantly reduces workload from the server and database, so pages will be displayed quickly even when the amount of data or visitors go up. We wanted to make cache invisible, so that developers and updaters don't have to think about it in their work.
Pages are cached the first time they are requested. They will update automatically, when content is modified through Bildy Editor or Bildy API. Update takes place also when templates are updated to server through Bildy Editor or any other editor (or uploaded with FTP client etc).
Caching is built in a way that it "just works and stays out of your way". However, you're able to fine tune the site performance by managing caching with these few simple methods. The rule of thumb is:
You can enable or disable caching of B tags and PHP blocks by:
These B tags can't be cached (for obvious reasons):
There's another level of invisible caching that makes Bildy even faster. Pages are also stored in fast cache that can cache all B tags, but not uncached PHP tags. This faster caching gets cleared when any change happens anywhere on the site, and then it will fall back to the slower caching mechanism. So the difference between these two caching levels are that the slower mechanism gets cleared only on those pages that are necessary to be cleared to update the contents and the faster mechanism clears every page in the cache no matter if the contents would get updated or not.
When creating a site that requires high performance, it is important to remember that the fast caching is completely bypassed when non-cached PHP is used. So use non-cached PHP blocks only when you know it's essential to be executed on every page load. If you don't, it only affects performance, but not behavior.
The reason why PHP blocks default to being non-cached is that we don't want to require understanding the caching process when creating Bildy templates. If PHP blocks were cached by default it would often lead to confusing and unintuitive results.
Here's how Bildy handles caching by default.
<!--
Contents of the page tags will be cached because all
inline ob tags are cached by default.
-->
<h1><b:page.topic/></h1>
<b:page.maincontent/>
<div class="info">
Last modified <b:page.metadata.modified /><br/>
<!--
This PHP won't be cached, so the date is refreshed with every page view.
-->
First seen on <?php echo date( "d.M.y" ); ?>
</div>
<h1>Images from that day</h1>
<!--
Even external data will be usually cached.
-->
<b:get from="images" name="image" parent="<b:page.metadata.url/>">
<img src="<b:image.imagefile/>" alt="<b:image.name/>" />
</b:get>
<h2>What others said</h2>
<!--
But this won't because Bildy detects B tags that are required by the non-cached
PHP.
If the PHP doesn't have references to the <b:get>, then <b:get>
will be cached even if PHP is not.
-->
<b:get from="quotes" name="quote" parent="<b:page.metadata.url/>">
<i><b:quote.content/></i>
- <?php echo( strtoupper( B::getField('quote','sender') ) ); ?>
</b:get>
To change the way Bildy caches pages, you can add <?php-cache or nocache="true". Here's how:
<h1><b:page.topic/></h1>
<b:page.maincontent/>
<div class="info">
Last modified <b:page.metadata.modified /><br/>
<!--
This PHP will be cached so the date will be written only once.
-->
First seen on <?php-cache echo( date( "d.M.y" ); ?>
</div>
<h1>Images from that day</h1>
<!--
External data won't be cached now.
Very useful when you want random ordering.
-->
<b:get from="images" name="image" parent="<b:page.metadata.url/>" orderby="rand()" limit="5" nocache="true">
<img src="<b:image.imagefile/>" alt="<b:image.name/>" />
</b:get>
<h2>What others said</h2>
<!--
Now also this request will be cached because the PHP inside the request
is cached. You should try to make PHP cacheable as often as you can
inside data requests to gain speed considerably, especially when there are
no non-cached PHP blocks on the page at all.
-->
<b:get from="quotes" name="quote" parent="<b:page.metadata.url/>">
<i><b:quote.content/></i>
- <?php-cache echo( strtoupper( B::getField('quote','sender') ) ); ?>
</b:get>