Boost Tips & Tricks
If you have a useful feature that works with Boost and it will help others, please add it to this page or add a comment to have it rolled into the page.
Using rules and PHP to refresh changed pages in cache
Case: The website has mostly anonymous visitors and a few content changes every so often. Waiting on cron to run may not be the best solution if you want changes to be available for anonymous visitors immediately. On a website such as this you are taking advantage of the Boost timestamp function to rebuild only pages that have changed at each cron run. This Rules-PHP-Trick works hand in hand with that Boost function as it will immediately refresh the cache with the one page that has has changed, rather than rebuild the entire cache.
Enable this Boost function:
[X] Check database timestamps for any site changes. Only if there's been a change will boost flush the expired content on cron.
Solution: Download the rules module, unzip it and upload it to sites/all/modules. Goto: (Administer > Site building > Modules > List) to enable Rules and PHP filter, save the changes. Goto: (Administer > Rules > Triggered rules > Add a new rule). Give the new rule a label or name, choose an Event that will trigger the rule from the select list (Content is going to be saved), check mark the box [X] This rule is active and should be evaluated when the associated event occurs. and save the changes. In the next section, choose (Add an action). Use the select list and choose (Execute custom PHP code), click next. Add the following code in the PHP Code text box and click save. Note: The PHP delimiters <?php and ?>are not needed.
global $base_root, $base_path;
drupal_http_request($base_root . $base_path . 'cron.php');
Now each time you create or update a page and save it, a cron run is called and will refresh the cache with the one page that has been changed. Your website visitors will see the new page immediately. A really neat feature!
Using Boost with latest version of Authcache
Case: There is a slight chance Boost will not work with latest version of Authcache.
solution:To get around this issue.
Goto (admin/settings/performance/boost)
In Boost advanced settings, disable this setting:
[ ] Asynchronous Opperation: output HTML, close connection, then store static file.
I "borrowed" some code from authcache, so we now use the same output buffer hooking mechanism; Boost's is more "Aggressive" though. It sends the page to the browser & closes the connection, then saves it to the disk, allowing for a more responsive site when using boost. With this change, the end game has to be something like the proposed hook_alter_html module; one that all page caching modules can use; thus preventing interference, and improving performance when using multiple page caching solutions.
Dynamically load the who's online block
Case: For sites that like to use a cache to serve the full page (boost, Drupal core cache, ect...), but still would like to have more dynamic content in a block; loading of blocks via ajax is a good way to accomplish this.
Solution: The simple way to do it, for one or 2 blocks it works. For anything more then that it would probably have a negative impact since it's doing a full bootstrap for each block.
More information and examples on this, see this page on Drupal Groups
example.php
<?php
include_once './includes/bootstrap.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
$block = module_invoke('user', 'block', 'view', 3);
print $block['content'];
?>Place this HTML in a new block
<div id="who-online">
</div>
<script>
$('#who-online').load('/example.php');
</script>


