$smwgCacheType

From semantic-mediawiki.org


Configuration parameter details:
Name $smwgCacheType
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


$smwgCacheType 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 1.9.0Released on 3 January 2014 and compatible with MW 1.19.0 - 1.22.x..1

This configuration parameter was superseded by configuration parameter $smwgMainCacheTypeSets 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 it will be removed with one of the upcoming releases of Semantic MediaWiki.

Default setting[edit]

$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[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
$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[edit]

Caching in general
Query result caching
Other

References

  1. ^  
    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 ..."