RE: [SMARTY] Cache cleanup
| From: | Gary Loescher | Date: | Fri, 14 Jun 2002 16:57:34 +0000 |
| Subject: | RE: [SMARTY] Cache cleanup | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-4860@lists.php.net to get a copy of this message | ||
>I should have seen this coming :-) OK, but when the file check _does_
>happen, it will cause noticable lag time... unless we can make the
>script release it's connection to the browser and then perform the
>cleanup and exit. I don't know if that is possible (?)
I think it might be possible to write the cache cleanup as an external
file and execute it with system() or popen(), as long as you redirect
stdout to a file (or /dev/null, etc) PHP won't wait for the command
to finish executing and will continue page processing normally. Hmm...
possible file-locking problems if cleanup is occurring while Smarty
is accessing the cache?
>
>* Should both cache and compile files be periodically cleaned?
I would vote for yes with an option for one, the other, or both.
>* Should this be part of the engine, or an optional plugin?
Plugin, since some will want to use a cronjob/batchfile to explicitly
control cleanup behavior. But for those that don't want to worry about
it, optional plugin would be great, I think.
Gary Loescher wrote:
> What about setting up a cache cleanup probability variable
> (ala PHP gc_probability for sessions) that determines when
> Smarty will clear the cache upon instantiation?
>
> Gary
>
> -----Original Message-----
> From: Monte Ohrt [mailto:monte@ispi.net]
> Sent: Friday, June 14, 2002 11:06 AM
> To: Peter Bowyer
> Cc: Ivo Jansch; smarty-general@lists.php.net
> Subject: Re: [SMARTY] Cache cleanup
>
>
> Cleaning cache files would be a considerable overhead. For _every_
cache
>
> file (recursively) it has to open file, extract timestamp, test
against
> the current time and unlink if necessary. It would definately add a
lot
> of execution time to the engine.
>
> It would be much more efficient to do this via cron:
>
> find /path/to/cache -atime +2 -exec rm -f {} \;
>
> This doesn't interefere with Smarty execution time either.
>
> Windows users would need a different method, maybe a php script to
> periodically run?
>
>
> Peter Bowyer wrote:
>
>>At 10:47 14/06/02 -0500, Monte Ohrt wrote:
>>
>>
>>>It won't happen automatically. You must do it yourself periodically,
>>>either with clear_cache or directly.
>>
>>
>>Shouldn't Smarty take care of cleaning out old files?
>>
>>Peter
>>
>>--
>>Maple Design - quality web design and programming
>>http://www.mapledesign.co.uk
>>
>>
>
>
>
>
--
Monte Ohrt <monte@ispi.net>
Director of Technology, ispi Inc.
--
Smarty General Mailing List (http://smarty.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php