Re: [SMARTY] Should $this->compile_check logic check the timestamp of parent & included php files?
| From: | Andrei Zmievski | Date: | Wed, 29 May 2002 15:13:00 +0000 |
| Subject: | Re: [SMARTY] Should $this->compile_check logic check the timestamp of parent & included php files? | ||
| References: | 1 2 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-4430@lists.php.net to get a copy of this message | ||
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