Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.0.x will end 8 May 2023 (12 months).
  • Bug fixes for security issues in 4.0.x will end 13 November 2023 (18 months).
  • PHP version: minimum PHP 7.3.0 Note: the minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is also supported.

Differences Between: [Versions 310 and 400] [Versions 311 and 400] [Versions 400 and 401] [Versions 400 and 402] [Versions 400 and 403]

Cache display administration helper. This file is part of Moodle's cache API, affectionately called MUC. It contains the components that are requried in order to use caching.

Author: Peter Burnett <peterburnett@catalyst-au.net>
Copyright: 2020 Catalyst IT
Copyright: 2012 Sam Hemelryk
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 887 lines (37 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class


Class: administration_display_helper  - X-Ref

A cache helper for administration tasks

__construct()   X-Ref
Please do not call constructor directly. Use cache_factory::get_administration_display_helper() instead.


get_definition_actions(\context $context, array $definitionsummary)   X-Ref
Returns all of the actions that can be performed on a definition.

return: array of actions. Each action is an action_url.
param: context $context the system context.
param: array $definitionsummary information about this cache, from the array returned by

get_store_instance_actions(string $name, array $storedetails)   X-Ref
Returns all of the actions that can be performed on a store.

return: array of actions. Each action is an action_url.
param: string $name The name of the store
param: array $storedetails information about this store, from the array returned by

get_store_plugin_actions(string $name, array $plugindetails)   X-Ref
Returns all of the actions that can be performed on a plugin.

return: array of actions. Each action is an action_url.
param: string $name The name of the plugin
param: array $plugindetails information about this store, from the array returned by

get_add_store_form(string $plugin)   X-Ref
Returns a form that can be used to add a store instance.

return: cachestore_addinstance_form
param: string $plugin The plugin to add an instance of

get_edit_store_form(string $plugin, string $store)   X-Ref
Returns a form that can be used to edit a store instance.

return: cachestore_addinstance_form
param: string $plugin
param: string $store

get_possible_locks_for_stores(string $plugindir, string $plugin)   X-Ref
Returns an array of suitable lock instances for use with this plugin, or false if the plugin handles locking itself.

return: array|false
param: string $plugindir
param: string $plugin

get_store_configuration_from_data(\stdClass $data)   X-Ref
Processes the results of the add/edit instance form data for a plugin returning an array of config information suitable to
store in configuration.

return: array
param: stdClass $data The mform data.

get_addable_lock_options()   X-Ref
Returns an array of lock plugins for which we can add an instance.

Suitable for use within an mform select element.

return: array

get_add_lock_form(string $plugin, array $lockplugin = null)   X-Ref
Gets the form to use when adding a lock instance.

return: cache_lock_form
param: string $plugin
param: array $lockplugin

get_lock_configuration_from_data(string $plugin, \stdClass $data)   X-Ref
Gets configuration data from a new lock instance form.

return: array
param: string $plugin
param: stdClass $data

perform_cache_actions(string $action, array $forminfo)   X-Ref
Handles the page actions, based on the parameter.

return: array the empty or overridden forminfo array.
param: string $action the action to handle.
param: array $forminfo an empty array to be overridden and set.

action_rescan_definition()   X-Ref
Performs the rescan definition action.

return: void

action_addstore()   X-Ref
Performs the add store action.

return: array an array of the form to display to the user, and the page title.

action_editstore()   X-Ref
Performs the edit store action.

return: array an array of the form to display, and the page title.

action_deletestore(string $action)   X-Ref
Performs the deletestore action.

return: void
param: string $action the action calling to this function.

action_editdefinitionmapping()   X-Ref
Performs the edit definition mapping action.

return: array an array of the form to display, and the page title.

action_editdefinitionsharing()   X-Ref
Performs the edit definition sharing action.

return: array an array of the edit definition sharing form, and the page title.

action_editmodemappings()   X-Ref
Performs the edit mode mappings action.

return: array an array of the edit mode mappings form.

action_purgedefinition()   X-Ref
Performs the purge definition action.

return: void

action_purge()   X-Ref
Performs the purge action.

return: void

action_newlockinstance()   X-Ref
Performs the new lock instance action.

return: array An array containing the new lock instance form.

action_deletelock(string $action)   X-Ref
Performs the delete lock action.

return: void
param: string $action the action calling this function.

generate_admin_page(\core_cache\output\renderer $renderer)   X-Ref
Outputs the main admin page by generating it through the renderer.

return: string the HTML for the admin page.
param: \core_cache\output\renderer $renderer the renderer to use to generate the page.

get_usage(int $samplekeys)   X-Ref
Gets usage information about the whole cache system.

This is a slow function and should only be used on an admin information page.

The returned array lists all cache definitions with fields 'cacheid' and 'stores'. For
each store, the following fields are available:

- name (store name)
- class (e.g. cachestore_redis)
- supported (true if we have any information)
- items (number of items stored)
- mean (mean size of item)
- sd (standard deviation for item sizes)
- margin (margin of error for mean at 95% confidence)
- storetotal (total usage for store if known, otherwise null)

The storetotal field will be the same for every cache that uses the same store.

return: array Details of cache usage
param: int $samplekeys Number of keys to sample when checking size of large caches