本文整理汇总了PHP中SMW\ApplicationFactory::newCacheFactory方法的典型用法代码示例。如果您正苦于以下问题:PHP ApplicationFactory::newCacheFactory方法的具体用法?PHP ApplicationFactory::newCacheFactory怎么用?PHP ApplicationFactory::newCacheFactory使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SMW\ApplicationFactory
的用法示例。
在下文中一共展示了ApplicationFactory::newCacheFactory方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: newMasterQueryEngine
/**
* @since 2.2
*
* @return QueryEngine
*/
public function newMasterQueryEngine()
{
$engineOptions = new EngineOptions();
$propertyHierarchyLookup = new PropertyHierarchyLookup($this->store, $this->applicationFactory->newCacheFactory()->newFixedInMemoryCache(500));
$propertyHierarchyLookup->setSubcategoryDepth($this->applicationFactory->getSettings()->get('smwgQSubcategoryDepth'));
$propertyHierarchyLookup->setSubpropertyDepth($this->applicationFactory->getSettings()->get('smwgQSubpropertyDepth'));
$circularReferenceGuard = new CircularReferenceGuard('sparql-query');
$circularReferenceGuard->setMaxRecursionDepth(2);
$compoundConditionBuilder = new CompoundConditionBuilder($engineOptions);
$compoundConditionBuilder->setCircularReferenceGuard($circularReferenceGuard);
$compoundConditionBuilder->setPropertyHierarchyLookup($propertyHierarchyLookup);
$queryEngine = new QueryEngine($this->store->getConnection('sparql'), $compoundConditionBuilder, new QueryResultFactory($this->store), $engineOptions);
return $queryEngine;
}
示例2: checkForRequestedUpdateByPagePurge
/**
* @note Article purge: In case an article was manually purged/moved
* the store is updated as well; for all other cases LinksUpdateConstructed
* will handle the store update
*
* @note The purge action is isolated from any other request therefore using
* a static variable or any other messaging that is not persistent will not
* work hence the reliance on the cache as temporary persistence marker
*/
private function checkForRequestedUpdateByPagePurge($parserData)
{
$cache = $this->applicationFactory->getCache();
$key = $this->applicationFactory->newCacheFactory()->getPurgeCacheKey($this->parser->getTitle()->getArticleID());
if ($cache->contains($key)) {
$cache->delete($key);
$parserData->updateStore();
}
return true;
}
示例3: newEntityLookup
/**
* @since 2.5
*
* @return EntityLookup
*/
public function newEntityLookup()
{
$settings = $this->applicationFactory->getSettings();
$directEntityLookup = new DirectEntityLookup($this->store);
if ($settings->get('smwgValueLookupCacheType') === CACHE_NONE) {
return $directEntityLookup;
}
$circularReferenceGuard = new CircularReferenceGuard('vl:store');
$circularReferenceGuard->setMaxRecursionDepth(2);
$cacheFactory = $this->applicationFactory->newCacheFactory();
$blobStore = $cacheFactory->newBlobStore('smw:vl:store', $settings->get('smwgValueLookupCacheType'), $settings->get('smwgValueLookupCacheLifetime'));
$cachedEntityLookup = new CachedEntityLookup($directEntityLookup, new RedirectTargetLookup($this->store, $circularReferenceGuard), $blobStore);
$cachedEntityLookup->setCachedLookupFeatures($settings->get('smwgValueLookupFeatures'));
return $cachedEntityLookup;
}
示例4: checkForRequestedUpdateByPagePurge
/**
* @note Article purge: In case an article was manually purged/moved
* the store is updated as well; for all other cases LinksUpdateConstructed
* will handle the store update
*
* @note The purge action is isolated from any other request therefore using
* a static variable or any other messaging that is not persistent will not
* work hence the reliance on the cache as temporary persistence marker
*/
private function checkForRequestedUpdateByPagePurge($parserData)
{
// Only carry out a purge where InTextAnnotationParser have set
// an appropriate context reference otherwise it is assumed that the hook
// call is part of another non SMW related parse
if ($parserData->getSemanticData()->getSubject()->getContextReference() === null) {
return true;
}
$cache = $this->applicationFactory->getCache();
$key = $this->applicationFactory->newCacheFactory()->getPurgeCacheKey($this->parser->getTitle()->getArticleID());
if ($cache->contains($key) && $cache->fetch($key)) {
$cache->delete($key);
$parserData->updateStore();
}
return true;
}
示例5: checkForRequestedUpdateByPagePurge
/**
* @note Article purge: In case an article was manually purged/moved
* the store is updated as well; for all other cases LinksUpdateConstructed
* will handle the store update
*
* @note The purge action is isolated from any other request therefore using
* a static variable or any other messaging that is not persistent will not
* work hence the reliance on the cache as temporary persistence marker
*/
private function checkForRequestedUpdateByPagePurge($parserData)
{
// Only carry out a purge where InTextAnnotationParser have set
// an appropriate context reference otherwise it is assumed that the hook
// call is part of another non SMW related parse
if ($parserData->getSemanticData()->getSubject()->getContextReference() === null) {
return true;
}
$cache = $this->applicationFactory->getCache();
$key = $this->applicationFactory->newCacheFactory()->getPurgeCacheKey($this->parser->getTitle()->getArticleID());
if ($cache->contains($key) && $cache->fetch($key)) {
$cache->delete($key);
// Set a timestamp explicitly to create a new hash for the property
// table change row differ and force a data comparison (this doesn't
// change the _MDAT annotation)
$parserData->getSemanticData()->setLastModified(wfTimestamp(TS_UNIX));
$parserData->updateStore();
}
return true;
}