public function testDeleteBatch() { $cache = new Cache(self::ROOT); $items = ['phpunit-test', 'phpunit-test2']; $this->assertTrue($cache->deleteBatch($items)); $this->assertFalse($cache->get('phpunit-test')); $this->assertFalse($cache->get('phpunit-test2')); }
public function __construct($noContainerCache = false) { $this->root = $this->root(); $cache = new Cache($this->root); $this->environment(); $this->errors(); $this->apiToken = $this->apiTokenFromRequest(); $items = ['collections', 'forms', 'bundles', 'topics', 'routes', 'container', 'languages', 'config']; $person = false; if (!empty($this->apiToken)) { $person = json_decode($cache->get('person-' . $this->apiToken), true); } $cacheResult = json_decode($cache->get($this->cachePrefix . '-opine'), true); $containerCache = []; if ($noContainerCache === false && isset($cacheResult['container'])) { $containerCache = $cacheResult['container']; } if ($cacheResult['routes'] != false) { $this->routeCached = true; } $config = new Config($this->root); if ($cacheResult['config'] !== false) { $configData = $cacheResult['config']; if (isset($configData[$this->environment])) { $config->cacheSet($configData[$this->environment]); } elseif (isset($configData['default'])) { $config->cacheSet($configData['default']); } } else { $config->cacheSet(); } $this->container = Container::instance($this->root, $config, $this->root . '/../config/containers/container.yml', $noContainerCache, $containerCache); $this->container->set('cache', $cache); $this->cache($cacheResult, $person); }