/** * Create the locale-service * * @param \Zend\ServiceManager\ServiceLocatorInterface $serviceLocator * @return \Zork\Cache\CacheManager */ public function createService(ServiceLocatorInterface $serviceLocator) { // Configure the locale $config = $serviceLocator->get('Configuration'); $srvConfig = isset($config['cache']) ? $config['cache'] : array(); return CacheManager::factory($srvConfig); }
/** * Test AbstractCacheStorage */ public function testAbstractCacheStorage() { $manager = CacheManager::factory(array('storage' => array('adapter' => array('name' => 'memory')))); $abstractStorage = $this->getMockBuilder('Zork\\Cache\\AbstractCacheStorage')->setMethods(null)->setConstructorArgs(array($manager))->getMock(); $this->assertInstanceOf('Zend\\Cache\\Storage\\StorageInterface', $abstractStorage->getCacheStorage()); }
/** * @param \Zork\Cache\CacheManager $cacheManager * @param string $namespace */ public function __construct(CacheManager $cacheManager, $namespace = null) { $this->setCacheStorage($cacheManager->createStorage($namespace ?: get_called_class())); }