ZF-1789: Zend_Cache_Frontend_Page tags and lifetime improvement

Issue Type: Improvement Created: 2007-07-30T09:52:21.000+0000 Last Updated: 2008-11-13T14:09:58.000+0000 Status: Resolved Fix version(s): - 1.7.0 (17/Nov/08)

Reporter: Ruslan Kononov (alan4ick) Assignee: Fabien MARTY (fab) Tags: - Zend_Cache

Related issues: Attachments:


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')) );


Posted by Darby Felton (darby) on 2007-07-31T09:17:03.000+0000

Assigning to [~fab] to initiate issue review.

Posted by Fabien MARTY (fab) on 2008-08-29T12:56:32.000+0000

just commited something like this into SVN trunk

can you try it ?

Posted by Nikolay Mogulev (katalonec) on 2008-08-30T12:27:16.000+0000

is it possible to see this update in 1.6 release?

Posted by Fabien MARTY (fab) on 2008-08-31T02:25:45.000+0000

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

Posted by Fabien MARTY (fab) on 2008-09-06T09:46:34.000+0000

fixed in SVN trunk

Posted by Nikolay Mogulev (katalonec) on 2008-09-08T01:08:49.000+0000

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

Posted by Fabien MARTY (fab) on 2008-09-08T11:41:51.000+0000

fixed, many thanks

Posted by Wil Sinclair (wil) on 2008-11-13T14:09:58.000+0000

Changing issues in preparation for the 1.7.0 release.

Have you found an issue?

See the Overview section for more details.


© 2006-2018 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.