Moodle APIs 3.9
Moodle 3.9.13+ (Build: 20220325)
Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
cache_config Class Reference

Public Member Functions

 __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. More...
 
 get_default_lock ()
 Gets the default lock instance. More...
 
 get_definition_by_id ($id)
 Gets a definition from the config given its name. More...
 
 get_definition_mappings ()
 Returns all of the known definition mappings. More...
 
 get_definitions ()
 Returns all the known definitions. More...
 
 get_definitions_by_store ($storename)
 Returns the definitions mapped into the given store name. More...
 
 get_lock_for_store ($storename)
 Returns the lock store configuration to use with a given store. More...
 
 get_locks ()
 Returns an array of the configured locks. More...
 
 get_mode_mappings ()
 Returns all of the configured mode mappings. More...
 
 get_site_identifier ()
 Returns the site identifier used by the cache API. More...
 
 get_stores ($mode, $requirements=0)
 Returns all of the stores that are suitable for the given mode and requirements. More...
 
 get_stores_for_definition (cache_definition $definition)
 Gets all of the stores that are to be used for the given definition. More...
 
 load ($configuration=false)
 Loads the configuration file and parses its contents into the expected structure. More...
 

Static Public Member Functions

static config_file_exists ()
 Checks if the configuration file exists. More...
 
static instance ()
 Gets an instance of the cache_configuration class. More...
 

Protected Member Functions

 include_configuration ()
 Includes the configuration file and makes sure it contains the expected bits. More...
 
 sort_mappings (array $a, array $b)
 Used to sort cache config arrays based upon a sort key. More...
 

Static Protected Member Functions

static get_config_file_path ()
 Returns the expected path to the configuration file. More...
 

Protected Attributes

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.
 

Member Function Documentation

◆ config_file_exists()

static cache_config::config_file_exists ( )
static

Checks if the configuration file exists.

Return values
boolTrue if it exists

◆ get_all_stores()

cache_config::get_all_stores ( )

Returns all of the configured stores.

Return values
array

◆ get_config_file_path()

static cache_config::get_config_file_path ( )
staticprotected

Returns the expected path to the configuration file.

Return values
stringThe absolute path

◆ get_default_lock()

cache_config::get_default_lock ( )

Gets the default lock instance.

Return values
array
Exceptions
cache_exception

◆ get_definition_by_id()

cache_config::get_definition_by_id (   $id)

Gets a definition from the config given its name.

Parameters
string$id
Return values
bool

◆ get_definition_mappings()

cache_config::get_definition_mappings ( )

Returns all of the known definition mappings.

Return values
array

◆ get_definitions()

cache_config::get_definitions ( )

Returns all the known definitions.

Return values
array

◆ get_definitions_by_store()

cache_config::get_definitions_by_store (   $storename)

Returns the definitions mapped into the given store name.

Parameters
string$storename
Return values
arrayAssociative 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
string$storename
Return values
array
Exceptions
cache_exception

◆ get_locks()

cache_config::get_locks ( )

Returns an array of the configured locks.

Return values
arrayArray of name => config

◆ get_mode_mappings()

cache_config::get_mode_mappings ( )

Returns all of the configured mode mappings.

Return values
array

◆ get_site_identifier()

cache_config::get_site_identifier ( )

Returns the site identifier used by the cache API.

Return values
string

◆ 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$modeOne of cache_store::MODE_*
int$requirementsThe requirements of the cache as a binary flag
Return values
arrayAn array of suitable stores.

◆ get_stores_for_definition()

cache_config::get_stores_for_definition ( cache_definition  $definition)

Gets all of the stores that are to be used for the given definition.

Parameters
cache_definition$definition
Return values
array

◆ 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
array
Exceptions
cache_exception

◆ instance()

static cache_config::instance ( )
static

Gets an instance of the cache_configuration class.

Return values
cache_config

◆ load()

cache_config::load (   $configuration = false)

Loads the configuration file and parses its contents into the expected structure.

Parameters
array | false$configurationCan be used to force a configuration. Should only be used when truly required.
Return values
boolean

◆ 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
array$a
array$b
Return values
int

The documentation for this class was generated from the following file: