RE: [SMARTY] Should $this->compile_check logic check the timestamp of parent & included php files?

From: Date: Wed, 29 May 2002 15:31:41 +0000
Subject: RE: [SMARTY] Should $this->compile_check logic check the timestamp of parent & included php files?
References: 1  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-4431@lists.php.net to get a copy of this message
To do this within the php script I would need to read in the contents of get_included_files(), then md5_file() each element in the array. Then concat the output for my cache id. I suppose I could also read in the contents of get_included_files() then just get the modified timestamp using filemtime(). Might make an interesting benchmark. Either one seems like the correct method. Thanks for your response. I sincerely appreciate the support this forum offers. I will add the above method to each php file on the site when generating the cache id, instead of making a change to the compile_check logic. Thanks! Robert Zwink -----Original Message----- From: Andrei Zmievski [mailto:andrei@ispi.net] Sent: Wednesday, May 29, 2002 11:13 AM To: Robert V. Zwink Cc: smarty-general@lists.php.net Subject: Re: [SMARTY] Should $this->compile_check logic check the timestamp of parent & included php files? On Wed, 29 May 2002, Robert V. Zwink wrote: > For the most part when I change a MySQL query within a PHP page it will have > an impact on the generated Smarty output. If I change the MySQL query > within an included php page it can also affect the Smarty output. We needed > to change a MySQL SELECT statement to only select LEFT(field, 255) for > performance reasons. This had an effect on records with fields longer than > 255. > > I might find a bug that when fixed could affect the generated output. The > problem now is that when the bug is fixed, the cache persists. It becomes > possible to have Smarty generated output of a php script persist even though > the script would no longer generate the same output. We don't neccesarily > want to purge all of the cached files when we update a page, we only want to > destory the cached output that could have been affected by the change. > > If we change a php page that generates output that is cached why would we > not want to update the cache when the php files are updated? The Smarty > class example is perfect, if I update the smarty class file, why wouldn't I > want to update all affected cache. They might end up being exactly the > same, but if there is a chance they would be different, it seems ideal to > have them updated immediately. You can generate a different cache ID based on your PHP file. For example, you could do md5() on the source of your PHP file and then use that as part of the cache ID. -Andrei http://www.gravitonic.com/ "Are you implying that cryptic pointer arithmetic isn't just as crystal clear as mere simple functions? What kind of a C programmer are you?" -- Zeev Suraski -- Smarty General Mailing List (http://smarty.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

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