0
кто-то может помочь мне настроить redis cache с помощью zend framework. Я успешно настроил кеш файловой системы следующим образом. global.pgpКак настроить Redis Cache с Zend framework 2?
return array(
'db' => array(
'driver' => 'Pdo',
'dsn' => 'mysql:dbname=tvguide;host=localhost',
'driver_options' => array(
PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES \'UTF8\''
),
),
'service_manager' => array(
'factories' => array(
'Zend\Db\Adapter\Adapter'
=> 'Zend\Db\Adapter\AdapterServiceFactory',
),
'factories' => array(
'Zend\Db\Adapter\Adapter' => 'Zend\Db\Adapter\AdapterServiceFactory',
'Zend\Cache\Storage\Filesystem' => function($sm) {
$cache = Zend\Cache\StorageFactory::factory(array(
'adapter' => 'filesystem',
'plugins' => array(
'exception_handler' => array('throw_exceptions' => false),
'serializer'
)
));
$cache->setOptions(array(
'cache_dir' => './data/cache'
));
return $cache;
},
),
),
);
Мои module.php
'factories' => array(
'json_hub\Model\Entity\CustomerQueriesTable' => function($sm) {
$dbAdapter = $sm->get('Zend\Db\Adapter\Adapter');
$cacheAdapter = $sm->get('Zend\Cache\Storage\Filesystem');
$table = new Model\Entity\CustomerQueriesTable($dbAdapter);
$table->setCache($cacheAdapter);
return $table;
},
)
в контроллере я позвонить в кэш, как показано ниже.
$this->cache->setItem('samplecache', $data);
ваша помощь, если высоко оценил
отблагодарить ваш .. я постараюсь это:). – Chali
нерабочий .. !! – Ritesh