ZF-1789: Zend_Cache_Frontend_Page tags and lifetime improvement

Description

I need to clear the cache only for pages with updated data. I have not found an opportunity of use tags in current version Zend_Cache_Frontend_Page. Therefore I have written this small patch.

--- D:/httpd/library/Zend/Cache/Frontend/Page.php.ori Mon Jul 23 23:21:01 2007 +++ D:/httpd/library/Zend/Cache/Frontend/Page.php Wed Jul 25 21:56:55 2007 @@ -79,6 +79,8 @@ 'make_id_with_session_variables' => true, 'make_id_with_files_variables' => true, 'make_id_with_cookie_variables' => true, + 'tags' => array(), + 'lifetime' => false, 'cache' => true ), 'regexps' => array() @@ -238,7 +240,7 @@ */ public function _flush($data) { - $this->save($data); + $this->save($data, null, $this->_activeOptions['tags'], $this->_activeOptions['lifetime']); return $data; }

Now you can set tags and lifetime for every regexp :

$frontendOptions = array( 'lifetime' => 3600, 'regexps' => array( '^/$' => array('cache' => true, 'tags' => array('tagNews','tagIndex') ), '^/news/' => array('cache' => true, 'tags' => array('tagNews') ) )

Later i can clear cached pages by tags :

$cache->clean(Zend_Cache::CLEANING_MODE_MATCHING_TAG, array('tagNews')) );

Comments

Assigning to [~fab] to initiate issue review.

just commited something like this into SVN trunk

can you try it ?

is it possible to see this update in 1.6 release?

no, we don't introduce new features during RC phase

but you can replace Zend/Cache directory and Zend/Cache.php on a 1.6 release by SVN trunk ones and it should be work without side effects on other components

fixed in SVN trunk

bug found: specificLifetime - this option should be in lowercase (specific_lifetime) because options compares with defaults in lowercase format

fixed, many thanks

Changing issues in preparation for the 1.7.0 release.