Help:Configuration parameter "$smwgCacheType"

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


Title $smwgCacheType
Description Sets which object cache Semantic MediaWiki should use to track temporary changes
Default setting
CACHE_ANYTHING
Software Semantic MediaWiki
First version supported
Last version supported still available
Configuration Cache
Keyword cache · object cache · performance

$smwgCacheType is a configuration parameter that sets the object cache Semantic MediaWiki should use to track temporary changes. The setting was introduced in Semantic MediaWiki 1.9.0Released on 3 January 2014 and compatible with MW 1.19.0 - 1.22.x..1

This configuration parameter will be superseded by configuration parameter $smwgMainCacheTypeSets which object cache Semantic MediaWiki should use to track temporary changes starting with Semantic MediaWiki 3.0.0Released on an unknown date and compatible with MW 1.27.0 - 1.30.x.. Thus you are advised to migrate your settings in "LocalSettings.php" to the new configuration parameter after the release of Semantic MediaWiki 3.0.0Released on an unknown date and compatible with MW 1.27.0 - 1.30.x. since this one will be removed with the release of Semantic MediaWiki 3.1.0Released on an unknown date and compatible with unknown versions of MediaWiki. in late 2018.

Default setting

$smwgCacheType = CACHE_ANYTHING;

This means that by default it uses the cache defined by configuration parameter $wgMainCacheType (MediaWiki.org) for object caching.

Available cache providers

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

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

Disable cache usage for Semantic MediaWiki
$smwgCacheType = CACHE_NONE;

This means that Semantic MediaWiki itself will not use any caching mechanism.

Use "memcached" as cache provider
$smwgCacheType = 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
$smwgCacheType = REDIS;
NoteNote:
  • 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

Caching in general
Query result caching
Other

References

  1. ^  Semantic MediaWiki: GitHub commit gh:smw:fb2c917
  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 ..."