$smwg­Value­Lookup­Cache­Type

From semantic-mediawiki.org


Configuration parameter details:
Name $smwgValueLookupCacheType
Description Sets a separate cache type for the object cache when requesting value lookups from the database
Default setting
CACHE_NONE
Software Semantic MediaWiki
Since version
Until version
Configuration Cache · Experimental
Keyword caching · object cache · performance · query performance · query lookup cache · query lookup · experimental


$smwgValueLookupCacheType is a configuration parameter that sets a separate cache type for the object cache Semantic MediaWiki should use when requesting value lookups from the database backend to allow for adding a more responsive cache layer. 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.12 and removed in Semantic MediaWiki 3.0.2Released on 11 April 2019 and compatible with MW 1.27.0 - 1.31.x.3 since it has not shown the expected improvements. Instead the internal prefetch lookup feature will be used.4

Using the feature connected to this configuration parameter is considered experimental!

Default setting[edit]

$smwgValueLookupCacheType = CACHE_NONE;

This means that by default it uses the standard relational database access for all lookups with no caching applied.

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 provider5 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:

Use whatever cache provider is available
$smwgValueLookupCacheType = CACHE_ANYTHING;

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

Use "memcached" as cache provider
$smwgValueLookupCacheType = 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
$smwgValueLookupCacheType = '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
Value lookup caching
Query result caching
Other


References

  1. ^  Semantic MediaWiki: GitHub pull request gh:smw:1035
  2. ^  Semantic MediaWiki: GitHub pull request gh:smw:1063
  3. ^  Semantic MediaWiki: GitHub pull request gh:smw:3808
  4. ^  Semantic MediaWiki: GitHub issue gh:smw:3722
  5. ^  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 ..."