Help:Configuration parameter "$smwgCacheUsage"

From semantic-mediawiki.org
Jump to: navigation, search
Title $smwgCacheUsage
Description Controls the caching behaviour or special pages related to Semantic MediaWiki. Requires configuration parameter $smwgCacheType be set; otherwise caching will have no effect.
Default setting
array( ... );
Software Semantic MediaWiki
First version supported 1.9.0
Last version supported 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 "Properties", "WantedProperties", "UnusedProperties", "SemanticStatistics" and "Statistics". 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", "Properties" and "SearchByProperty". 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.0.

Default setting

$GLOBALS['smwgCacheUsage'] = array(
    'smwgWantedPropertiesCache' => true,
    'smwgWantedPropertiesCacheExpiry' => 3600,
    'smwgUnusedPropertiesCache' => true,
    'smwgUnusedPropertiesCacheExpiry' => 3600,
    'smwgPropertiesCache' => true,
    'smwgPropertiesCacheExpiry' => 3600,
    'smwgStatisticsCache' => true,
    'smwgStatisticsCacheExpiry' => 3600
);

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

Available options

Options related to special page "WantedProperties"
  • smwgWantedPropertiesCache - Sets whether to serve statistical data for wanted properties from cache or not. Default is "true".
  • smwgWantedPropertiesCacheExpiry - Sets the number of seconds before the cache expires. Default is "3600" (one hour).
Options related to special page "UnusedProperties"
  • smwgUnusedPropertiesCache - Sets whether to serve statistical data for unused properties from cache or not. Default is "true".
  • smwgUnusedPropertiesCacheExpiry - Sets the number of seconds before the cache expires. Default is "3600" (one hour).
Options related to special page "Properties"
  • smwgPropertiesCache - Sets whether to serve statistical data for properties from cache or not. Default is "true".
  • smwgPropertiesCacheExpiry - Sets the number of seconds before the cache expires. Default is "3600" (one hour).
Options related to special page "SemanticStatistics"
  • smwgStatisticsCache - Sets whether to serve statistical data for properties from cache or not. Default is "true".
  • smwgStatisticsCacheExpiry - Sets the number of seconds before the cache expires. Default is "3600" (one hour).

Changing the default setting

NoteNote: 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.

Disabling the caching for a specific special page

To disable the caching for e.g. special page "Properties" add the following to your "LocalSettings.php" file:

$smwgCacheUsage = array(
    'smwgWantedPropertiesCache' => true,
    'smwgWantedPropertiesCacheExpiry' => 3600,
    'smwgUnusedPropertiesCache' => true,
    'smwgUnusedPropertiesCacheExpiry' => 3600,
    'smwgPropertiesCache' => false,
    'smwgPropertiesCacheExpiry' => 3600,
    'smwgStatisticsCache' => true,
    'smwgStatisticsCacheExpiry' => 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" add the following to your "LocalSettings.php" file:

$smwgCacheUsage = array(
    'smwgWantedPropertiesCache' => true,
    'smwgWantedPropertiesCacheExpiry' => 86400,
    'smwgUnusedPropertiesCache' => true,
    'smwgUnusedPropertiesCacheExpiry' => 86400,
    'smwgPropertiesCache' => true,
    'smwgPropertiesCacheExpiry' => 3600,
    'smwgStatisticsCache' => true,
    'smwgStatisticsCacheExpiry' => 86400
);