Zend Framework

Add setLifeTime into the cache class

Details

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

Description

A setLifeTime() method would be very-very handful to change the lifetime without initialize a new cache object. At the moment we must have as much cache object as much lifetime we want use instead of using one cache object.

if(!$cache->start('mypage')) {
		echo 'This is cached with init lifetime ('.time().') ';
		$cache->end(); 
}

$cache->setLifeTime( 3 );

if(!$cache->start('mypage2')) {
		echo 'This is cached with 3 seconds lifetime ('.time().') ';
		$cache->end();
}

Activity

Hide
Fabien MARTY added a comment -

please have a look at the API :

http://framework.zend.com/apidoc/core/Zend_Cache/Zend_Cache_Core.html#setLifetime

you can specify an alternative lifetime in the save method or you can use the setLifetime() method which... already exists !

Show
Fabien MARTY added a comment - please have a look at the API : http://framework.zend.com/apidoc/core/Zend_Cache/Zend_Cache_Core.html#setLifetime you can specify an alternative lifetime in the save method or you can use the setLifetime() method which... already exists !
Hide
Fabien MARTY added a comment -

sorry, I read too fast your issue

I didn't see you talk about the Page frontend

Show
Fabien MARTY added a comment - sorry, I read too fast your issue I didn't see you talk about the Page frontend
Hide
Fabien MARTY added a comment -

in the current version, you can pass a specificLifetime for the end() method

$cache->end(array(), 3600);

array() is an optional array of tags
Show
Fabien MARTY added a comment - in the current version, you can pass a specificLifetime for the end() method
$cache->end(array(), 3600);

array() is an optional array of tags

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: