Re: [SMARTY-DEV] Changed cache_lifetime-handling and added expiration date

From: Date: Fri, 12 Apr 2002 19:00:30 +0000
Subject: Re: [SMARTY-DEV] Changed cache_lifetime-handling and added expiration date
References: 1  Groups: php.smarty.dev 
Request: Send a blank email to php-smarty-dev+get-55@lists.php.net to get a copy of this message
Actually, does this affect intended behavior? If I change the cache_lifetime, should I expect this to be respected on all existing cache files? Norbert Röcher wrote:
Hi, i've done a little change to the current cvs-version of smarty.class.php For each cached file now the expirationdate is written to the cache_info and is used as indicator for "is_cached". Benefit is to check if a cached file expired, independent from the current lifetime-setting in smarty. The lifetime-setting is now only used to set expiration-time. I think is is VERY usefull. change 1 (new line at 1417):
    function _write_cache_file($tpl_file, $cache_id, $compile_id,
$results)
    {
        // put timestamp in cache header
        $this->_cache_info['timestamp'] = time();
        $this->_cache_info['expires'] = time() + $this->cache_lifetime;
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ change 2 (line 1483 after upper change):
        if ($this->cache_lifetime > -1 && (time() >
$this->_cache_info['expires'])) { ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ That's all. The change has NO effect on other functions and works just fine. Would be nice, if this would be integrated to future releases. Best regards, Norbert
-- Monte Ohrt <monte@ispi.net> Director of Technology, ispi Inc.

« previous php.smarty.dev (#55) next »