コード例 #1
0
 /**
  * Create Service Factory
  * @param ServiceLocatorInterface $serviceLocator
  * @return \Zend\Cache\Storage\StorageInterface
  */
 public function createService(ServiceLocatorInterface $serviceLocator)
 {
     $config = $serviceLocator->get('config');
     $storageOptions = $config['zf-hipsters']['keyvalue'];
     $storageName = !empty($storageOptions['adapter']['name']) ? $storageOptions['adapter']['name'] : 'keyvalue';
     StorageFactory::getAdapterPluginManager()->setInvokableClass($storageName, 'ZfHipsters\\KeyValueStorage\\Adapter\\StorageAdapter');
     $cache = StorageFactory::factory($storageOptions);
     return $cache;
 }
コード例 #2
0
 /**
  * {@inheritDoc}
  *
  * @return CacheListener
  */
 public function createService(ServiceLocatorInterface $serviceLocator)
 {
     // @@TODO Esto es correcto que vaya aca?
     $adapterPluginManager = StorageFactory::getAdapterPluginManager();
     $adapterPluginManager->setInvokableClass('htmlcache', 'Columnis\\Model\\HtmlCache');
     $storageAdapter = $serviceLocator->get('Zend\\Cache');
     $options = $storageAdapter->getOptions();
     $options->setNamespace('columnis');
     $cacheListener = new CacheListener($storageAdapter);
     return $cacheListener;
 }
コード例 #3
0
ファイル: StorageFactoryTest.php プロジェクト: haoyanfei/zf2
 public function testChangeAdapterPluginManager()
 {
     $adapters = new Cache\Storage\AdapterPluginManager();
     Cache\StorageFactory::setAdapterPluginManager($adapters);
     $this->assertSame($adapters, Cache\StorageFactory::getAdapterPluginManager());
 }