RE: [SMARTY] caching example
| From: | Andrew S. Nagy | Date: | Mon, 31 Mar 2003 18:24:53 +0000 |
| Subject: | RE: [SMARTY] caching example | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-9018@lists.php.net to get a copy of this message | ||
> -----Original Message-----
> From: Monte Ohrt [mailto:monte@ispi.net]
> Sent: Monday, March 31, 2003 12:54 PM
> To: Andrew S. Nagy
> Cc: Smarty General
> Subject: RE: [SMARTY] caching example
>
>
> If you use the session ID as the cache ID, you are essentially creating
> a separate set of cache files for every page, every visitor. What are
> you gaining by using caching in this case? It seem that it would be an
> unnecessary (and big!) overhead. You might be better off leaving caching
> off for session-based personalized content. If the pages have a lot of
> content that is identical for every user, cache that only and leave the
> personalized parts uncached.
We gain in not having to call the database as often, we can eliminate 50-80%
of the database calls by having the content cached. Then whenever the
content is changed, the cache files are deleted. Yes, in a high traffic
area of the site, the user may not benefit from the cache; however, the low
traffic areas will benefit greatly. So it seems that it is better to have
it than not at all. And by breaking up the templates into multiple
templates, some caches can be trashed while others (such as a template with
the user's name) can stay around for a long time.
The problem is in how the site works, with the level of personalization and
the grouping of content, caching is very complicated. So I need to figure a
way to get some performance increases for parts of the site that don't have
a lot of traffic.
Monty, does this make sense?
I am curious to here what others think of this usage.
>
> Monte
>
> On Mon, 2003-03-31 at 10:13, Andrew S. Nagy wrote:
> > I am building a large scale CMS with smarty and am following
> this practice
> > of breaking up the templates and including them; however, we
> are also using
> > a cache_id for each cache and the cache_id is set to the session id. So
> > each logged in user has it's own cache for their session, just
> don't forget
> > to call the clear cache in the gc function!
> >
> > Has anyone else done anything like this? How does it work for you?
> >
> > Andrew
> >
> > > -----Original Message-----
> > > From: Wom.bat [mailto:wom.bat@gmx.net]
> > > Sent: Saturday, March 29, 2003 9:59 PM
> > > To: Paul Lockaby; smarty-general@lists.php.net
> > > Subject: Re: [SMARTY] caching example
> > >
> > >
> > > > I have a site that has logins with usernames and ids and stuff like
> > > > that. It shows the username on each page. I want to cache
> stuff, but I
> > > > don't want to cache the usernames. What is the easiest way
> to display a
> > > > username or other user specific information while still
> caching the rest
> > > > of the document? I'm aware that I can use insert, but
> perhaps there is
> > > > some other trick that I'm not aware of...
> > >
> > > insert is _very_ slow, you better split your template into
> several smaller
> > > ones, so that you can cache parts of the page. I'd recommend
> an index.tpl
> > > file which includes login.inc.php, content.inc.php etc via include_php
> > >
> > > Regards,
> > > David
> > >
> > >
> > >
> > > --
> > > Smarty General Mailing List (http://smarty.php.net/)
> > > To unsubscribe, visit: http://www.php.net/unsub.php
> > >
> > >
> --
> Monte Ohrt <monte@ispi.net>
>
>
> --
> Smarty General Mailing List (http://smarty.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>