$smwgMainCacheType

From semantic-mediawiki.org


Configuration parameter details:
Name $smwgMainCacheType
Description Sets which object cache Semantic MediaWiki should use to track temporary changes
Default setting
CACHE_ANYTHING
Software Semantic MediaWiki
Since version
Until version still available
Configuration Cache
Keyword cache · object cache · performance


$smwgMainCacheType is a configuration parameter that sets the object cache Semantic MediaWiki should use to track temporary changes. The configuration parameter was introduced in Semantic MediaWiki 2.3.0Released on 29 October 2015 and compatible with MW 1.19.0 - 1.25.x..1

This configuration parameter was not being used until Semantic MediaWiki 3.0.0Released on 11 October 2018 and compatible with MW 1.27.0 - 1.31.x.. It now superseded configuration parameter $smwgCacheTypeSets which object cache Semantic MediaWiki should use to track temporary changes starting with Semantic MediaWiki 3.0.0Released on 11 October 2018 and compatible with MW 1.27.0 - 1.31.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 11 October 2018 and compatible with MW 1.27.0 - 1.31.x. since the superseded one will be removed with one of the upcoming releases of Semantic MediaWiki.

Default setting[edit]

$smwgMainCacheType = CACHE_ANYTHING;

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

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]

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

Disable cache usage for Semantic MediaWiki
$smwgMainCacheType = CACHE_NONE;

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

Use "memcached" as cache provider
$smwgMainCacheType = 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
$smwgMainCacheType = '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[edit]

Caching in general
Query result caching
Other

References

  1. ^  Semantic MediaWiki: GitHub pull request gh:smw:1035
  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 ..."