Пример #1
0
 public function getServiceConfig()
 {
     return array('invokables' => array('serviceCurrency' => 'Course\\Service\\Currency', 'Course\\Service\\Logs' => 'Course\\Service\\Logs'), 'factories' => array('CacheAdapter' => function ($serviceManager) {
         $config = $serviceManager->get('config');
         $host = isset($config['memcached']['host']) ? $config['memcached']['host'] : 'localhost';
         $port = isset($config['memcached']['port']) ? $config['memcached']['port'] : '11211';
         $cache = new \Zend\Cache\Storage\Adapter\Memcached();
         $cache->setOptions(array('servers' => array(array($host, $port)), 'namespace' => 'MYMEMCACHEDNAMESPACE', 'liboptions' => array('COMPRESSION' => true, 'binary_protocol' => true, 'no_block' => true, 'connect_timeout' => 100)));
         $plugin = new \Zend\Cache\Storage\Plugin\ExceptionHandler();
         $plugin->getOptions()->setThrowExceptions(false);
         $cache->addPlugin($plugin);
         return $cache;
     }));
 }
Пример #2
0
 public function getServiceConfig()
 {
     return array('factories' => array('Zend\\Cache\\Storage\\Adapter\\Apc' => function ($sm) {
         $cache = new Zend\Cache\Storage\Adapter\Apc();
         $cache->getOptions()->setTtl(3600);
         $plugin = new Zend\Cache\Storage\Plugin\ExceptionHandler();
         $plugin->getOptions()->setThrowExceptions(false);
         $cache->addPlugin($plugin);
         return $cache;
     }, 'Zend\\Cache\\Storage\\Adapter\\Filesystem' => function ($sm) {
         $cache = new \Zend\Cache\Storage\Adapter\Filesystem();
         $cache->getOptions()->setWritable(TRUE)->setReadable(TRUE)->setTtl(3600)->setCacheDir('./data/cache/filesystem')->setDirPermission("777")->setFilePermission('666');
         $plugin = new \Zend\Cache\Storage\Plugin\ExceptionHandler();
         $plugin->getOptions()->setThrowExceptions(false);
         $cache->addPlugin($plugin);
         $pluginSerializer = new \Zend\Cache\Storage\Plugin\Serializer();
         $cache->addPlugin($pluginSerializer);
         return $cache;
     }, 'Zend\\Session\\SessionManager' => new \Application\Session\Service\AppSessionManagerFactory(), 'index_navigation' => function (\Zend\ServiceManager\ServiceManager $sm) {
         $navigationF = new Navigation\Service\CIndexNavidationFactory(null, $sm);
         $navigation = $navigationF->createService($sm);
         return $navigation;
     }, 'admin_navigation' => function ($sm) {
         $navigationF = new Navigation\Service\CAdminNavidationFactory();
         $navigation = $navigationF->createService($sm);
         return $navigation;
     }));
 }