/** * 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; }
/** * {@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; }
public function testChangeAdapterPluginManager() { $adapters = new Cache\Storage\AdapterPluginManager(); Cache\StorageFactory::setAdapterPluginManager($adapters); $this->assertSame($adapters, Cache\StorageFactory::getAdapterPluginManager()); }