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

From: Date: Fri, 12 Apr 2002 18:58:37 +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-54@lists.php.net to get a copy of this message
This sounds fine to me, although I'm not sure how it handles the case where $this->_cache_info['expires'] is not set (should only happen when upgrading Smarty) Will it work as expected (regenerate cache), or must Smarty provide for this test, or all cache files be erased first? 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 (#54) next »