Re[2]: [SMARTY] cache and session ID
| From: | Jacques Jocelyn | Date: | Fri, 04 Apr 2003 05:47:34 +0000 |
| Subject: | Re[2]: [SMARTY] cache and session ID | ||
| References: | 1 2 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-9071@lists.php.net to get a copy of this message | ||
Hello messju,
mm> if you want to avoid this. extend Smarty class, define your own display()
mm> and do
mm> function display(...) {
mm> ob_start();
mm> parent::display(...);
mm> $output = ob_get_contents();
mm> ob_end_clean();
mm> /* run your output-filters on the cached contents here,
mm> replace your session-ids inside $output, for example.
mm> */
mm> echo $output;
mm> }
mm> this is a performance hit against plain caching, of course, but it
mm> should work for quite some time. :)
I tried that and as you said, it's a big performance issue.
without the extension, the page gets generated in 0.32 sec
with the extension : 0.74 !
however by redefining the fetch function, I could gain 0.05 dropping the
generated time to 0.69.
I have redefined the attribute FETCH function as follow :
function fetch($_smarty_tpl_file, $_smarty_cache_id = null,
$_smarty_compile_id = null, $SID, $_smarty_display = false){
[...]
echo ereg_replace("/SID/[a-zA-Z0-9]{32}","/SID/$SID",$_smarty_results);
[...]
}
Best regards,
Jacques