Semantic MediaWiki and related extensions
Public Member Functions | Public Attributes | List of all members
SMW\Query\Result\CachedQueryResultPrefetcher Class Reference
Collaboration diagram for SMW\Query\Result\CachedQueryResultPrefetcher:
Collaboration graph
[legend]

Public Member Functions

 __construct (Store $store, QueryFactory $queryFactory, BlobStore $blobStore, BufferedStatsdCollector $bufferedStatsdCollector)
 
 getStats ()
 
 setHashModifier ($hashModifier)
 
 setLogger (LoggerInterface $logger)
 
 setQueryEngine (QueryEngine $queryEngine)
 
 isEnabled ()
 
 disableCache ()
 
 recordStats ()
 
 setNonEmbeddedCacheLifetime ($nonEmbeddedCacheLifetime)
 
 getQueryResult (Query $query)
 
 resetCacheBy ($items, $context= '')
 

Public Attributes

const VERSION = '1'
 
const CACHE_NAMESPACE = 'smw:query:store'
 
const STATSD_ID = 'smw:query:store:1:d:'
 
const POOLCACHE_ID = 'queryresult.prefetcher'
 

Detailed Description

The prefetcher only caches the subject list from a computed a query condition. The result is processed before an individual query printer has access to the query result hence it does not interfere with the final string output manipulation.

The main objective is to avoid unnecessary computing of results for queries that have the same query signature. PrintRequests as part of a QueryResult object are not cached and are not part of a query signature.

Cache eviction is carried out either manually (action=purge) or executed through the QueryDepedencyLinksStore.

GNU GPL v2+

Since
2.5
Author
mwjames

Constructor & Destructor Documentation

SMW\Query\Result\CachedQueryResultPrefetcher::__construct ( Store  $store,
QueryFactory  $queryFactory,
BlobStore  $blobStore,
BufferedStatsdCollector  $bufferedStatsdCollector 
)
Since
2.5
Parameters
Store$store
QueryFactory$queryFactory
BlobStore$blobStore
BufferedStatsdCollector$bufferedStatsdCollector

Member Function Documentation

SMW\Query\Result\CachedQueryResultPrefetcher::disableCache ( )
Since
2.5
Parameters
QueryEngine$queryEngine
SMW\Query\Result\CachedQueryResultPrefetcher::getQueryResult ( Query  $query)
See also
QueryEngine::getQueryResult
Since
2.5

Returns a QueryResult object that matches the condition described by a query.

Note
If the request was made for a debug (querymode MODE_DEBUG) query then a simple HTML-compatible string is returned.
Since
2.5
Parameters
Query$query
Returns
QueryResult|string

Implements SMW\QueryEngine.

SMW\Query\Result\CachedQueryResultPrefetcher::getStats ( )
Since
2.5
Returns
array
SMW\Query\Result\CachedQueryResultPrefetcher::isEnabled ( )
Since
2.5
Parameters
boolean
SMW\Query\Result\CachedQueryResultPrefetcher::recordStats ( )
Since
2.5
SMW\Query\Result\CachedQueryResultPrefetcher::resetCacheBy (   $items,
  $context = '' 
)
Since
2.5
Parameters
DIWikiPage | array$items
string$context
SMW\Query\Result\CachedQueryResultPrefetcher::setHashModifier (   $hashModifier)
Since
2.5
Parameters
string | integer$hashModifier
SMW\Query\Result\CachedQueryResultPrefetcher::setLogger ( LoggerInterface  $logger)
See also
LoggerAwareInterface::setLogger
Since
2.5
Parameters
LoggerInterface$logger
SMW\Query\Result\CachedQueryResultPrefetcher::setNonEmbeddedCacheLifetime (   $nonEmbeddedCacheLifetime)
Since
2.5
Parameters
integer | boolean$nonEmbeddedCacheLifetime
SMW\Query\Result\CachedQueryResultPrefetcher::setQueryEngine ( QueryEngine  $queryEngine)
Since
2.5
Parameters
QueryEngine$queryEngine

Member Data Documentation

const SMW\Query\Result\CachedQueryResultPrefetcher::CACHE_NAMESPACE = 'smw:query:store'

Namespace occupied by the BlobStore

const SMW\Query\Result\CachedQueryResultPrefetcher::POOLCACHE_ID = 'queryresult.prefetcher'

ID for the tempCache

const SMW\Query\Result\CachedQueryResultPrefetcher::STATSD_ID = 'smw:query:store:1:d:'

ID used by the bufferedStatsdCollector, requires to be changed in case the data schema is modified

PHP 5.6 can do self::CACHE_NAMESPACE . ':' . self::VERSION

const SMW\Query\Result\CachedQueryResultPrefetcher::VERSION = '1'

Update this version number when the serialization format changes.


The documentation for this class was generated from the following file: