public function testDeleteCache() { $listLookup = $this->getMockBuilder('\\SMW\\SQLStore\\Lookup\\ListLookup')->disableOriginalConstructor()->getMock(); $listLookup->expects($this->once())->method('getLookupIdentifier')->will($this->returnValue('Foo#123')); $cache = $this->getMockBuilder('\\Onoi\\Cache\\Cache')->disableOriginalConstructor()->getMock(); $cache->expects($this->once())->method('delete')->with($this->stringContains('llc')); $cacheOptions = new \stdClass(); $instance = new CachedListLookup($listLookup, $cache, $cacheOptions); $instance->deleteCache(); }
public function testDeleteCache() { $listLookup = $this->getMockBuilder('\\SMW\\SQLStore\\Lookup\\ListLookup')->disableOriginalConstructor()->getMock(); $listLookup->expects($this->once())->method('getLookupIdentifier')->will($this->returnValue('Foo#123')); $cache = $this->getMockBuilder('\\Onoi\\Cache\\Cache')->disableOriginalConstructor()->getMock(); $cache->expects($this->once())->method('fetch')->will($this->returnValue(serialize(array('smw:llc:6283479db90b04ad3a6db333a3c89766' => true)))); $cache->expects($this->atLeastOnce())->method('delete')->with($this->stringContains('llc')); $cacheOptions = new \stdClass(); $instance = new CachedListLookup($listLookup, $cache, $cacheOptions); $instance->deleteCache(); }
/** * @since 2.2 * * @param ListLookup $listLookup * @param boolean $useCache * @param integer $cacheExpiry * * @return ListLookup */ public function newCachedListLookup(ListLookup $listLookup, $useCache, $cacheExpiry) { $cacheFactory = ApplicationFactory::getInstance()->newCacheFactory(); $cacheOptions = $cacheFactory->newCacheOptions(array('useCache' => $useCache, 'ttl' => $cacheExpiry)); $cachedListLookup = new CachedListLookup($listLookup, $cacheFactory->newMediaWikiCompositeCache($cacheFactory->getMainCacheType()), $cacheOptions); $cachedListLookup->setCachePrefix($cacheFactory->getCachePrefix()); return $cachedListLookup; }