$smwgQueryResultCacheType
Configuration parameter details: | |
Name | $smwgQueryResultCacheType |
Description | Sets whether the query result cache may be used |
Default setting | CACHE_NONE |
Software | Semantic MediaWiki |
Since version | |
Until version | still available |
Configuration | Cache · Experimental |
Keyword | caching · object cache · performance · query performance · query result cache · experimental |
$smwgQueryResultCacheType
is a configuration parameter that sets whether the query result cache feature may be used. It was introduced in Semantic MediaWiki 2.5.0Released on 14 March 2017 and compatible with MW 1.23.0 - 1.29.x..1
Default setting[edit]
$smwgQueryResultCacheType = CACHE_NONE;
This means that by default the query result cache feature is disabled.
Available cache providers[edit]
All predefined cache types as provided by configuration parameter $wgMainCacheType
(MediaWiki.org) or a custom cache type as set with configuration parameter $wgObjectCaches
(MediaWiki.org), e.g. Redis which is the recommended cache provider2 to account for an optimal response time, storage capacity, and independence from the DB master.
CACHE_NONE
: Does not caching (predefined)CACHE_ANYTHING
: Allows to use whatever cache provider is available (predefined)CACHE_ACCEL
: Allows to use "APC" as cache provider (predefined)CACHE_MEMCACHED
: Allows to use "memcached" as cache provider (predefined, requires additional setup on the server)CACHE_DB
: Allows to use the relational database backend as cache provider (predefined)redis
: Allows to use "Redis" as cache provider (custom, requires additional setup on the server)
Changing the default setting[edit]
This feature can be enabled by adding a cache type as the setting to this configuration parameter, either a predefined cache type or a custom cache type. The wiki will then try to minimize the computational effort for queries that share the same query signature.
To modify the setting to this configuration parameter, add one of the following lines to your "LocalSettings.php" file after the enableSemantics()
call:
- Use whatever cache provider is available
$smwgQueryResultCacheType = CACHE_ANYTHING;
- Use "memcached" as cache provider
$smwgQueryResultCacheType = CACHE_MEMCACHED;
- Use "redis" as cache provider
$smwgQueryResultCacheType = 'redis';
- Additional setup on the wiki's server as well as further configuration in "LocalSettings.php" is required to be able to used this cache provider.
This is the recommended cache provider.
See also[edit]
- Caching in general
- Help page on caching
- Help page on configuration parameter
$wgMainCacheType
(MediaWiki.org) - Help page on configuration parameter
$smwgMainCacheType
Sets which object cache Semantic MediaWiki should use to track temporary changes
- Query result caching
- Help page on the query result cache
- Help page on configuration parameter
$smwgQueryResultCacheLifetime
Sets the cache lifetime of embedded queries and their results fetched from the query engine - Help page on configuration parameter
$smwgQueryResultNonEmbeddedCacheLifetime
Sets the cache lifetime of non-embedded queries and their results fetched from the query engine - Help page on configuration parameter
$smwgQueryResultCacheRefreshOnPurge
Sets whether it is possible to manually refresh the query cache by doing a "purge" action
- Embedded query updating
- Help page on embedded query updates
- Help page on configuration parameter
$smwgEnabledQueryDependencyLinksStore
Sets whether tracking and storing of dependencies of embedded queries may be used
- Other
- Help page on speeding up Semantic MediaWiki
- Help page on configuration parameter
$smwgValueLookupCacheType
Sets a separate cache type for the object cache when requesting value lookups from the database
References
- ^ Semantic MediaWiki: GitHub pull request gh:smw:1251
- ^ Why Redis beats Memcached for caching "... Memcached and Redis serve as in-memory, key-value data stores ... Redis gives you much greater flexibility regarding the objects you can cache. While Memcached limits key names to 250 bytes and works with plain strings only, Redis allows key names and values to be as large as 512MB ..."