ZF-2685: adding method to update the expire time of cached data

Issue Type: New Feature Created: 2008-02-19T03:01:39.000+0000 Last Updated: 2008-11-13T14:09:58.000+0000 Status: Resolved Fix version(s): - 1.7.0 (17/Nov/08)

Reporter: Marc Bennewitz (GIATA mbH) (mben) Assignee: Fabien MARTY (fab) Tags: - Zend_Cache

Related issues: Attachments:


Currently the load and save process is the following:

<pre class="highlight">
if ( !($data=$cache->load($cacheId)) ) {
    // loading data
    $cache->save($data, $cacheId);

but if the time to load data is longer as the next run of this code than the the data will load and save more than once To avoid this show the folloging:

<pre class="highlight">
if ( !($data=$cache->load($cacheId)) ) {
    if ( $cache->test($cacheId, true) ) {   // missing second argument -> $doNotTestExpire
        // set the expire time to the next 2 minutes
        // the next calls will load these data from cache
        $cache->updateExpire($cacheId, 120);

    // -> loading data

    // update or creaete the cache
    // the next calls will load the current data from cache
    $cache->save($data, $cacheId);


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

just commited into SVN trunk a new method "touch($id, $extendedLifetime)" (for File and Apc backend only, for the moment)

can you try it ?


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

fixed in SVN trunk

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.