Changed cache_lifetime-handling and added expiration date

From: Date: Fri, 12 Apr 2002 17:51:50 +0000
Subject: Changed cache_lifetime-handling and added expiration date
Groups: php.smarty.dev 
Request: Send a blank email to php-smarty-dev+get-53@lists.php.net to get a copy of this message
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

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