Re: [SMARTY] Benchmarking cache and inserts
| From: | Wom.bat | Date: | Sat, 07 Jun 2003 09:49:46 +0000 |
| Subject: | Re: [SMARTY] Benchmarking cache and inserts | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-9677@lists.php.net to get a copy of this message | ||
hm...
I somehow have the impression that I am the only human being on this nice
planet who's using the following approach:
index.tpl, called by index.php or whatever, NOT cached
it includes other applications (menu, content, ads etc) via include_php
these applications use caching
that's a very fast solution (you just have to be careful what to put into
your index.tpl), and you have no hassle with inserts (which are REALLY
slow!)
just my 1.99 cents,
David
> I don't really understand what the whole hassle is about. I have a very
> scalable and fast CMS based all around smarty and caching. I use the
> insert function for banners and dynamic image rotation only, and none of
> my pages takes longer than 0.06-0.09 seconds to render, that is from
> scratch, and if called from cache directly, then the time falls down to
> 0.035-0.04. I find caching a very elegant solution, but one should not
> overdo it, since in some cases it doesn't really bring much except for
> flooding your host.
>
> Nino Katic wrote:
> > On Fri, 6 Jun 2003, Paul Lockaby wrote:
> >
> >
> >>Alrighty, try this:
> >>
> >>main.php
> >>====================
> >>$smarty->caching = 2; // different cache times for each page
> >>// ... code ...
> >>$smarty->cache_lifetime = 3600; // cache for one hour
> >>$smarty->display($phdisplay, $cacheid);
> >>
> >>maintemplate.tpl
> >>====================
> >>{insert name="images" template="foo" ...}
> >>
> >>insert.images.php
> >>====================
> >>function insert_images($params, &$smarty) {
> >> extract($params);
> >> if (!$smarty->is_cached($template, $cacheid)) {
> >> // ... code ...
> >> }
> >> $smarty->cache_lifetime = 600; // cache for 10 minutes
> >> return $smarty->fetch($template, $cacheid);
> >>}
> >>
> >
> >
> > Thx. Paul I'll try it. One more strange thing is that now (after maybe
> > 1 hour) i tried to measure the time one more time with the same code,
and
> > now i get results like 0,30 sec. insted of 0,70 sec ?? I'm running it on
> > windows, so who knows what's going on :-)
> >
> > Nino
> >
> >
>
> --
> .::....::.:...::...:..:.:::..:..::..::.::..:.:.
>
> Kulikov Alexey - E-Com Development Consultant
>
> +43 699 1 9228792 | alex@inses.biz
>
>
> --
> .::....::.:...::...:..:.:::..:..::..::.::..:.:.
>
> Kulikov Alexey - E-Com Development Consultant
>
> +43 699 1 9228792 | alex@inses.biz
>
>
> --
> Smarty General Mailing List (http://smarty.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>