Cache configuration reader.
More...
|
| __construct () |
| Please use cache_config\instance to get an instance of the cache config that is ready to be used.
|
|
| get_all_stores () |
| Returns all of the configured stores.
|
|
| get_default_lock () |
| Gets the default lock instance.
|
|
| get_definition_by_id ($id) |
| Gets a definition from the config given its name.
|
|
| get_definition_mappings () |
| Returns all of the known definition mappings.
|
|
| get_definitions () |
| Returns all the known definitions.
|
|
| get_definitions_by_store ($storename) |
| Returns the definitions mapped into the given store name.
|
|
| get_lock_for_store ($storename) |
| Returns the lock store configuration to use with a given store.
|
|
| get_locks () |
| Returns an array of the configured locks.
|
|
| get_mode_mappings () |
| Returns all of the configured mode mappings.
|
|
| get_site_identifier () |
| Returns the site identifier used by the cache API.
|
|
| get_stores ($mode, $requirements=0) |
| Returns all of the stores that are suitable for the given mode and requirements.
|
|
| get_stores_for_definition (cache_definition $definition) |
| Gets all of the stores that are to be used for the given definition.
|
|
| load ($configuration=false) |
| Loads the configuration file and parses its contents into the expected structure.
|
|
|
static | config_file_exists () |
| Checks if the configuration file exists.
|
|
static | instance () |
| Gets an instance of the cache_configuration class.
|
|
|
| include_configuration () |
| Includes the configuration file and makes sure it contains the expected bits.
|
|
| sort_mappings (array $a, array $b) |
| Used to sort cache config arrays based upon a sort key.
|
|
|
array | $configdefinitionmappings = array() |
| The definition mappings that have been configured.
|
|
array | $configdefinitions = array() |
| The configured definitions as picked up from cache.php files.
|
|
array | $configlocks = array() |
| An array of configured cache lock instances.
|
|
array | $configmodemappings = array() |
| The configured mode mappings.
|
|
array | $configstores = array() |
| The configured stores.
|
|
string | $siteidentifier = null |
| The site identifier used when the cache config was last saved.
|
|
Cache configuration reader.
This class is used to interact with the cache's configuration. The configuration is stored in the Moodle data directory.
- Copyright
- 2012 Sam Hemelryk
- License
- http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
◆ config_file_exists()
static cache_config::config_file_exists |
( |
| ) |
|
|
static |
Checks if the configuration file exists.
- Return values
-
◆ get_all_stores()
cache_config::get_all_stores |
( |
| ) |
|
Returns all of the configured stores.
- Return values
-
◆ get_config_file_path()
static cache_config::get_config_file_path |
( |
| ) |
|
|
staticprotected |
Returns the expected path to the configuration file.
- Return values
-
◆ get_default_lock()
cache_config::get_default_lock |
( |
| ) |
|
Gets the default lock instance.
- Return values
-
- Exceptions
-
◆ get_definition_by_id()
cache_config::get_definition_by_id |
( |
| $id | ) |
|
Gets a definition from the config given its name.
- Parameters
-
- Return values
-
◆ get_definition_mappings()
cache_config::get_definition_mappings |
( |
| ) |
|
Returns all of the known definition mappings.
- Return values
-
◆ get_definitions()
cache_config::get_definitions |
( |
| ) |
|
Returns all the known definitions.
- Return values
-
◆ get_definitions_by_store()
cache_config::get_definitions_by_store |
( |
| $storename | ) |
|
Returns the definitions mapped into the given store name.
- Parameters
-
- Return values
-
array | Associative array of definitions, id=>definition |
◆ get_lock_for_store()
cache_config::get_lock_for_store |
( |
| $storename | ) |
|
Returns the lock store configuration to use with a given store.
- Parameters
-
- Return values
-
- Exceptions
-
◆ get_locks()
cache_config::get_locks |
( |
| ) |
|
Returns an array of the configured locks.
- Return values
-
array | Array of name => config |
◆ get_mode_mappings()
cache_config::get_mode_mappings |
( |
| ) |
|
Returns all of the configured mode mappings.
- Return values
-
◆ get_site_identifier()
cache_config::get_site_identifier |
( |
| ) |
|
Returns the site identifier used by the cache API.
- Return values
-
◆ get_stores()
cache_config::get_stores |
( |
| $mode, |
|
|
| $requirements = 0 ) |
Returns all of the stores that are suitable for the given mode and requirements.
- Parameters
-
int | $mode | One of cache_store\MODE_* |
int | $requirements | The requirements of the cache as a binary flag |
- Return values
-
array | An array of suitable stores. |
◆ get_stores_for_definition()
Gets all of the stores that are to be used for the given definition.
- Parameters
-
- Return values
-
◆ include_configuration()
cache_config::include_configuration |
( |
| ) |
|
|
protected |
Includes the configuration file and makes sure it contains the expected bits.
You need to ensure that the config file exists before this is called.
- Return values
-
- Exceptions
-
◆ instance()
static cache_config::instance |
( |
| ) |
|
|
static |
Gets an instance of the cache_configuration class.
- Return values
-
◆ load()
cache_config::load |
( |
| $configuration = false | ) |
|
Loads the configuration file and parses its contents into the expected structure.
- Parameters
-
array | false | $configuration | Can be used to force a configuration. Should only be used when truly required. |
- Return values
-
◆ sort_mappings()
cache_config::sort_mappings |
( |
array | $a, |
|
|
array | $b ) |
|
protected |
Used to sort cache config arrays based upon a sort key.
Highest number at the top.
- Parameters
-
- Return values
-
The documentation for this class was generated from the following file: