Help:Configuration parameter "$smwgQueryResultCacheType"

From semantic-mediawiki.org
Jump to: navigation, search
edit with form (experimental)


Title $smwgQueryResultCacheType
Description Sets whether the query result cache may be used
Default setting
CACHE_NONE
Software Semantic MediaWiki
First version supported 2.5.0
Last version supported still available
Configuration Cache
Keyword Caching · Performance · Query performance

$smwgQueryResultCacheType is a configuration parameter that sets whether the query result cache feature may be used. It was introduced in Semantic MediaWiki 2.5.0.1

Important noteImportant Note: Using the feature connected to this configuration parameter is experimental!

The default setting "CACHE_NONE" disables the query result cache feature. 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.

Default setting

$GLOBALS['smwgQueryResultCacheType'] = CACHE_NONE;

This means that by default the query result cache feature is disabled.

Available cache providers

All predefined cache types as provided by MediaWiki's $wgMainCacheType configuration parameter or a custom cache type as set with MediaWiki's $wgObjectCaches configuration parameter, 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

NoteNote: When enabling this feature by adding a cache provider to this setting, it is recommended to also enable the embedded query update feature.

To modify this configuration setting, add one of the following lines to your "LocalSettings.php" file after the enableSemantics() call:

Use whatever cache provider is available
$smwgQueryResultCacheType = CACHE_ANYTHING;
NoteNote: Use this setting if unsure which cache provider is available and should be used.
Use "memcached" as cache provider
$smwgQueryResultCacheType = CACHE_MEMCACHED;
NoteNote: Additional setup on the wiki's server is required to be able to used this cache provider.
Use "redis" as cache provider
$smwgQueryResultCacheType = REDIS;
NoteNote:
  • Additional setup on the wiki's server as well ad further configuration in "LocalSettings.php" is required to be able to used this cache provider.
  • This is the recommended cache provider.

See also

References

  1. ^  Semantic MediaWiki: GitHub pull request #1251
  2. ^  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 ..."