Google News
logo
Zend framework - Interview Questions
What is CallbackCache in Zend framework?
The callback cache pattern caches calls of non specific functions and methods given as a callback.
 
Quick Start :  For instantiation you can use the PatternFactory or do it manual:
use Zend\Cache\PatternFactory;
use Zend\Cache\Pattern\PatternOptions;

// Via the factory:
$callbackCache = PatternFactory::factory('callback', array(
    'storage'      => 'apc',
    'cache_output' => true,
));

// OR, the equivalent manual instantiation:
$callbackCache = new \Zend\Cache\Pattern\CallbackCache();
$callbackCache->setOptions(new PatternOptions(array(
    'storage'      => 'apc',
    'cache_output' => true,
)));

 

Option Data Type Default Value Description
storage string array Zend\Cache\Storage\StorageInterface <none> The storage to write/read cached data
cache_output boolean true Cache output of callback
Advertisement