Re: [SMARTY] Caching for portals?

From: Date: Mon, 15 Apr 2002 14:39:44 +0000
Subject: Re: [SMARTY] Caching for portals?
References: 1  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-3733@lists.php.net to get a copy of this message
There are two different "fetch" functions, and they have different behavior. One is in the Smarty API. This gets interpreted as a template: index.php --------- $smarty->fetch('foo.tpl'); The other is a template function. This is not interpreted, but displayed as-is: index.tpl --------- {fetch file="/path/to/foo.tpl"} Brian E. Lozier wrote:
"But fetch does not interpret Smarty language, just fetches the file from the filesystem "as is"... or maybe I am wrong?" You are wrong, the fetch() fetches the interpreted value, not just the file. It all depends on how much traffic you get. If you're serving multiple pages per SECOND (a lot of traffic), how "bad" would it be to serve them content that's perhaps a minute old? Because regenerating the cache every minute would probably result in being able to serve way more pages than handling say 60 database connections and 120 queries every second (in a dynamic situation that serves 60 pages / sec and every page takes 2 queries to generate). All depends on your app and what you need to do and how much traffic the site gets. 4/14/02 2:15:07 PM, Michal Prinke <bogien@conecto.pl> wrote:
Linus McCabe wrote:
You can use the insert function to include parts of uncached data in cached content. You can also turn on and off cache for different display() or fetch() calls.
Inserts require writing separate functions for each uncached part: {insert name="getPollYes"} people voted "YES" {insert name="getPollNo"} people voted "NO" blah blah blah Today is {insert name="getCurrentDate"} blah blah blah ...and this could make your project very complicated. Norbert Rocher wrote:
You could clear cached file after a change of your contents.
Hmmm... I would have to store and check all the template variables which were used to build every cached page. I think it would be ineffective, besides, talking about portals, they change from second to second...
"Include" keeps up dynamic inserts and its output gets cached within the including template.
So it means that you cannot cache included sub-templates separetely, because they get cached within the topmost template, called from the PHP script by $smarty->display() or $smarty->fetch()?
If you don't use inserts just fetch the block and put it to it's location in the upper template. "Fetch" makes use of caching its output, but doesn't allow inserts when you put the output into an upper template.
But fetch does not interpret Smarty language, just fetches the file
from the filesystem "as is"... or maybe I am wrong?
Brad Atkins wrote:
To be most flexible, I think that both the nocache and insert calls should be valid. As in some cases, yes, the insert and the use of a seperate template is necessary (banner ads).
100% agree. This would be the best solution. -- Smarty General Mailing List (http://smarty.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Brian
-- Monte Ohrt <monte@ispi.net> Director of Technology, ispi Inc.

« previous php.smarty.general (#3733) next »