appendCallback() public method

Callbacks are always called at runtime, their result is never cached at this level. You may cache it in the callback, of course.
public appendCallback ( callable $callback ) : boolean
$callback callable
return boolean
 protected function _startcallback(CacheAbstract $cache)
 {
     $key = new CacheKey("startcallback", 1);
     $cache->clean($key);
     $this->assertFalse($cache->start($key));
     echo "something ";
     $this->assertTrue($cache->appendCallback('callbackTesterStart'));
     echo " otherthing";
     $output = $cache->end(false);
     $this->assertContains(CALLBACKVALUE, $output);
     // run again, we should have another value
     $second = $cache->start($key, null, false);
     $this->assertNotFalse($second);
     $this->assertContains(CALLBACKVALUE, $second);
     $this->assertNotEquals($second, $output);
 }
Beispiel #2
0
 public function _dependencies(CacheAbstract $cache)
 {
     $cache->start('parent', 1);
     $cache->addDependency();
     echo 'parent start/';
     $this->assertFalse($cache->appendCallback('nawreanaweroi'));
     // invalid
     $cache->appendCallback('cacheCallback');
     $cache->start('child', 2);
     echo '|child first|';
     $cache->end(false);
     echo 'parent end/';
     $cache->end(false);
 }