How about if we save a lot of time recreating a report that hasn't changed:
function configdoc_page($form_state) {
$report = cache_get('configdoc_report');
if ($configdoc_output = cache_get('configdoc_report')) {
$configdoc_output = $report->data;
}
else {
$configdoc_output = configdoc_create();
cache_set('configdoc_report', $configdoc_output);
}
$form = array();
//$form['#action'] = base_path().'admin/reports/configdoc/save';
$form['body'] = array(
'#type' => 'textarea',
'#title' => t('Report'),
'#default_value' => $configdoc_output,
'#rows' => 30,
// '#cols' => 80,
'#description' => t('If you are copying and pasting this into another site, you may wish to include a preformatted tag (<pre></pre>).'),
);
Since module admin (amongst many others) will clear the cache, this will not be a problem.
On my test site, this saved better than 30 seconds per refresh.
Also note the description change, which I discovered posting the output to DO.
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | configdoc_05.patch | 5.01 KB | nancydru |
Comments
Comment #1
nancydruThe attached patch includes the above, plus includes the settings page menu entry that got dropped from #580432: Cache report and removes a bunch of lines that had only two blanks (per coding standards).