public function testCanUse() { $instance = new BlobStore('Foo', $this->cache); $this->assertTrue($instance->canUse()); $instance->setUsageState(false); $this->assertFalse($instance->canUse()); }
/** * Remove a cache item that appears during an alteration action (update, * change, delete) to ensure that we always have the correct set of matches. * * @since 2.3 * * @param DIWikiPage|null $subject */ public function resetCacheBy(DIWikiPage $subject = null) { if (!$this->blobStore->canUse() || $subject === null) { return null; } // Remove a redirect target subject directly $redirects = $this->getSemanticData($subject)->getPropertyValues(new DIProperty('_REDI')); foreach ($redirects as $redirectTarget) { $this->blobStore->delete($this->getHashFrom($redirectTarget)); } $sid = $this->getHashFrom($subject); // Remove all linked objects $container = $this->blobStore->read($sid); if ($container->has('list')) { foreach (array_keys($container->get('list')) as $id) { $this->blobStore->delete($id); } } $this->blobStore->delete($sid); }
private function canUse($query) { return $this->enabledCache && $this->blobStore->canUse() && ($query->getContextPage() !== null || $query->getContextPage() === null && $this->nonEmbeddedCacheLifetime > 0); }