Zend Framework

Zend_Cache_Frontend_Page tags and lifetime improvement

Details

  • Type: Improvement Improvement
  • Status: Resolved Resolved
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 1.0.0
  • Fix Version/s: 1.7.0
  • Component/s: Zend_Cache
  • Labels:
    None

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

Activity

Hide
Darby Felton added a comment -

Assigning to Fabien MARTY to initiate issue review.

Show
Darby Felton added a comment - Assigning to Fabien MARTY to initiate issue review.
Hide
Fabien MARTY added a comment -

just commited something like this into SVN trunk

can you try it ?

Show
Fabien MARTY added a comment - just commited something like this into SVN trunk can you try it ?
Hide
Nikolay Mogulev added a comment -

is it possible to see this update in 1.6 release?

Show
Nikolay Mogulev added a comment - is it possible to see this update in 1.6 release?
Hide
Fabien MARTY added a comment -

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

Show
Fabien MARTY added a comment - 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
Hide
Fabien MARTY added a comment -

fixed in SVN trunk

Show
Fabien MARTY added a comment - fixed in SVN trunk
Hide
Nikolay Mogulev added a comment -

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

Show
Nikolay Mogulev added a comment - bug found: specificLifetime - this option should be in lowercase (specific_lifetime) because options compares with defaults in lowercase format
Hide
Fabien MARTY added a comment -

fixed, many thanks

Show
Fabien MARTY added a comment - fixed, many thanks
Hide
Wil Sinclair added a comment -

Changing issues in preparation for the 1.7.0 release.

Show
Wil Sinclair added a comment - Changing issues in preparation for the 1.7.0 release.

People

Vote (2)
Watch (3)

Dates

  • Created:
    Updated:
    Resolved: