$smwgCacheUsage

From semantic-mediawiki.org


Configuration parameter details:
Name $smwgCacheUsage
Description Sets how the caching behaviour or special pages related to Semantic MediaWiki is controlled
Default setting See below
Software Semantic MediaWiki
Since version
Until version still available
Configuration Cache
Keyword cache · object cache · special page · performance


$smwgCacheUsage is a configuration parameter that is used to control the caching behaviour of special pages displaying statistical information about the the property usage count on the respective special pages: special page "Properties"Lists properties and displays their usage, special page "WantedProperties"Lists used properties with no explicit datatype assignment, special page "UnusedProperties"Lists properties with an explicit datatype assignment without having a value assignment (annotation), special page "SemanticStatistics"Lists statistics about semantic data and special page "Statistics"No description was provided.. Moreover this setting also controls the feature providing search suggestions with autocompletion to improve the selection of properties on special pages that have input fields namely special page "Ask"Provides an interface that assists users with creating and executing semantic queries, special page "Properties"Lists properties and displays their usage and special page "SearchByProperty"Allows to search the wiki by properties or property value combinations. Thus the setting helps increasing the overall performance of the wiki by avoiding to access the individual tables holding the property information and count the respective rows on each access. It was introduced in Semantic MediaWiki 1.9.0Released on 3 January 2014 and compatible with MW 1.19.0 - 1.22.x.. With Semantic MediaWiki 3.0.0Released on 11 October 2018 and compatible with MW 1.27.0 - 1.31.x. it was extended by the option to control the caching for API-module "smwbrowse"Allows to search for properties, categories and concepts.1

This configuration parameter requires configuration parameter $smwgCacheTypeSets which object cache Semantic MediaWiki should use to track temporary changes be set; otherwise caching will have no effect.
This configuration parameter underwent a major change in Semantic MediaWiki 3.0.0Released on 11 October 2018 and compatible with MW 1.27.0 - 1.31.x. with regard to the available options aiming at simplifying the setup.2 See this version of the documentation available for releases prior to Semantic MediaWiki 3.0.0Released on 11 October 2018 and compatible with MW 1.27.0 - 1.31.x..

Default setting[edit]

$smwgCacheUsage = array(
	'special.wantedproperties' => 3600,
	'special.unusedproperties' => 3600,
	'special.properties' => 3600,
	'special.statistics' => 3600,
	'api.browse' => 3600,
	'api.browse.pvalue' => 3600,
	'api.task'  => 3600
);

The default means that all statistical information on the special pages mentioned as well as for the API module mentioned above are being cached for one hour.

Available options[edit]

Option related to special page "WantedProperties"Lists used properties with no explicit datatype assignment
  • special.wantedproperties – Sets whether to serve statistical data for wanted properties from cache and the number of seconds before the cache expires. Default is "3600" (one hour). Set to "false" to disable caching.
Option related to special page "UnusedProperties"Lists properties with an explicit datatype assignment without having a value assignment (annotation)
  • special.unusedproperties – Sets whether to serve statistical data for unused properties from cache and the number of seconds before the cache expires. Default is "3600" (one hour). Set to "false" to disable caching.
Option related to special page "Properties"Lists properties and displays their usage
  • special.properties – Sets whether to serve statistical data for properties from cache and the number of seconds before the cache expires. Default is "3600" (one hour). Set to "false" to disable caching.
Option related to special page "SemanticStatistics"Lists statistics about semantic data
  • special.statistics – Sets whether to serve statistical data for properties from cache and the number of seconds before the cache expires. Default is "3600" (one hour). Set to "false" to disable caching.
Options related to API-module "smwbrowse"Allows to search for properties, categories and concepts
  • api.browse – Sets whether to serve statistical data from cache for objects, i.e. properties, categories and concepts, to be searched via the the "browse" module. It also sets the number of seconds before the cache expires. Serves as general cache. Default is "3600" (one hour). Set to "false" to disable caching.
  • api.browse.pvalue – Sets whether to serve statistical data from cache for property values to be searched via the "pvalue" module. It also sets the number of seconds before the cache expires. Default is "3600" (one hour). Set to "false" to disable caching.
Options related to API-module "smwtask"Allows to invoke and execute internal Semantic MediaWiki tasks
  • api.task – Sets whether to serve statistical data from cache for the "task" module. It also sets the number of seconds before the cache expires. Default is "3600" (one hour). Set to "false" to disable caching.

Changing the default setting[edit]

To change one or more of the settings for this configuration parameter always the whole array has to be added to your "LocalSettings.php" file, even if some option were not changed from their defaults.

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

Disabling the caching for a specific special page

To disable the caching for e.g. special page "Properties"Lists properties and displays their usage:

$smwgCacheUsage = array(
	'special.wantedproperties' => 3600,
	'special.unusedproperties' => 3600,
	'special.properties' => false,
	'special.statistics' => 3600,
	'api.browse' => 3600,
	'api.browse.pvalue' => 3600,
	'api.task'  => 3600
);
Disable caching for the api module

To disable the caching for e.g. API-module "smwbrowse"Allows to search for properties, categories and concepts:

$smwgCacheUsage = array(
	'special.wantedproperties' => 3600,
	'special.unusedproperties' => 3600,
	'special.properties' => 3600,
	'special.statistics' => 3600,
	'api.browse' => false,
	'api.browse.pvalue' => false,
	'api.task'  => 3600
);
Extending the caching period for specific special pages

To extend the caching period to one day for e.g. all special pages except for special page "Properties"Lists properties and displays their usage:

$smwgCacheUsage = array(
	'special.wantedproperties' => 86400,
	'special.unusedproperties' => 86400,
	'special.properties' => 3600,
	'special.statistics' => 86400,
	'api.browse' => 3600,
	'api.browse.pvalue' => 3600,
	'api.task'  => 3600
);

References

  1. ^  |  Semantic MediaWiki: GitHub pull request gh:smw:2699
  2. ^  |  Semantic MediaWiki: GitHub pull request gh:smw:2730