Moodle PHP Documentation 5.1
Moodle 5.1dev (Build: 20250706) (a6b17d8f6bd)
|
Public Member Functions | |
create_cache (definition $definition) | |
Common public method to create a cache instance given a definition. | |
create_cache_from_definition ($component, $area, array $identifiers=[], $unused=null) | |
Creates a cache object given the parameters for a definition. | |
create_cache_from_params ($mode, $component, $area, array $identifiers=[], array $options=[]) | |
Creates an ad-hoc cache from the given param. | |
create_config_instance ($writer=false) | |
Creates a cache config instance with the ability to write if required. | |
create_definition ($component, $area, $unused=null) | |
Creates a definition instance or returns the existing one if it has already been created. | |
create_lock_instance (array $config) | |
Returns a lock instance ready for use. | |
create_store_from_config ($name, array $details, definition $definition) | |
Creates a store instance given its name and configuration. | |
get_adhoc_caches_in_use () | |
Gets all adhoc caches that have been used within this request. | |
get_caches_in_use () | |
Returns the cache instances that have been used within this request. | |
get_state () | |
Returns the current state of the cache API. | |
get_store_instances_in_use (definition $definition) | |
Returns an array of cache stores that have been initialised for use in definitions. | |
is_disabled () | |
Returns true if the cache API has been disabled. | |
is_initialising () | |
Returns true if the cache is currently initialising itself. | |
is_updating () | |
Returns true if the cache is currently updating itself. | |
reset_cache_instances () | |
Resets the stores, clearing the array of created stores. | |
set_state ($state) | |
Updates the state fo the cache API. | |
stores_disabled () | |
Returns true if the cache stores have been disabled. | |
updating_finished () | |
Informs the factory that the upgrading has finished. | |
updating_started () | |
Informs the factory that the cache is currently updating itself. | |
Static Public Member Functions | |
static | clear_temporary_caches () |
Removes all temporary caches. | |
static | disable_stores () |
Disables cache stores. | |
static | get_administration_display_helper () |
Returns an instance of the current display_helper. | |
static | get_disabled_writer () |
Gets the config_writer to use when caching is disabled. | |
static | instance ($forcereload=false) |
Returns an instance of the factory method. | |
static | reset () |
Resets the arrays containing instantiated caches, stores, and config instances. | |
Protected Member Functions | |
create_dummy_store (definition $definition) | |
Creates a dummy store object for use when a loader has no potential stores to use. | |
Static Protected Member Functions | |
static | disable () |
Disables as much of the cache API as possible. | |
Static Protected Attributes | |
static core_cache local administration_display_helper | $displayhelper = null |
The current cache display helper. | |
static factory | $instance |
An instance of the factory class created upon the first request. | |
static array | $tempcaches = [] |
Array of temporary caches in use. | |
|
static |
Removes all temporary caches.
Don't call this directly - used by {
core_cache\disabled_factory::create_cache | ( | definition | $definition | ) |
Common public method to create a cache instance given a definition.
definition | $definition |
application_cache|session_cache|store |
coding_exception |
Reimplemented from core_cache\factory.
core_cache\disabled_factory::create_cache_from_definition | ( | $component, | |
$area, | |||
array | $identifiers = [], | ||
$unused = null ) |
Creates a cache object given the parameters for a definition.
string | $component | |
string | $area | |
array | $identifiers | |
string | $unused | Used to be datasourceaggregate but that was removed and this is now unused. |
application_cache|session_cache|request_cache |
Reimplemented from core_cache\factory.
core_cache\disabled_factory::create_cache_from_params | ( | $mode, | |
$component, | |||
$area, | |||
array | $identifiers = [], | ||
array | $options = [] ) |
Creates an ad-hoc cache from the given param.
int | $mode | |
string | $component | |
string | $area | |
array | $identifiers | |
array | $options | An array of options, available options are:
|
application_cache|session_cache|request_cache |
Reimplemented from core_cache\factory.
core_cache\disabled_factory::create_config_instance | ( | $writer = false | ) |
Creates a cache config instance with the ability to write if required.
bool | $writer | Unused. |
disabled_config|config_writer |
Reimplemented from core_cache\factory.
core_cache\disabled_factory::create_definition | ( | $component, | |
$area, | |||
$unused = null ) |
Creates a definition instance or returns the existing one if it has already been created.
string | $component | |
string | $area | |
string | $unused | Used to be datasourceaggregate but that was removed and this is now unused. |
definition |
Reimplemented from core_cache\factory.
|
protectedinherited |
Creates a dummy store object for use when a loader has no potential stores to use.
definition | $definition |
dummy_cachestore |
|
inherited |
Returns a lock instance ready for use.
array | $config |
lockable_cache_interface |
core_cache\disabled_factory::create_store_from_config | ( | $name, | |
array | $details, | ||
definition | $definition ) |
Creates a store instance given its name and configuration.
string | $name | Unused. |
array | $details | Unused. |
definition | $definition |
boolean|store |
Reimplemented from core_cache\factory.
|
staticprotectedinherited |
Disables as much of the cache API as possible.
All of the magic associated with the disabled cache is wrapped into this function. In switching out the factory for the disabled factory it gains full control over the initialisation of objects and can use all of the disabled alternatives. Simple!
This function has been marked as protected so that it cannot be abused through the public API presently. Perhaps in the future we will allow this, however as per the build up to the first release containing MUC it was decided that this was just to risky and abusable.
|
staticinherited |
Disables cache stores.
The cache API will continue to function however none of the actual stores will be used. Instead the dummy store will be provided for all cache requests. This is useful in situations where you cannot be sure any stores are working.
In order to re-enable the cache you must call the cache factories static reset method: // Disable the cache factory. factory::disable_stores(); // Re-enable the cache factory by resetting it. factory::reset();
|
inherited |
Gets all adhoc caches that have been used within this request.
store[] | Caches currently in use |
|
staticinherited |
Returns an instance of the current display_helper.
administration_helper |
|
inherited |
Returns the cache instances that have been used within this request.
array |
|
staticinherited |
Gets the config_writer to use when caching is disabled.
This should only be called from disabled_factory.
config_writer |
|
inherited |
Returns the current state of the cache API.
int |
|
inherited |
Returns an array of cache stores that have been initialised for use in definitions.
definition | $definition |
array |
|
static |
Returns an instance of the factory method.
bool | $forcereload | Unused. |
factory |
coding_exception |
Reimplemented from core_cache\factory.
core_cache\disabled_factory::is_disabled | ( | ) |
Returns true if the cache API has been disabled.
bool |
Reimplemented from core_cache\factory.
|
inherited |
Returns true if the cache is currently initialising itself.
This includes both initialisation and saving the cache config file as part of that initialisation.
bool |
|
inherited |
Returns true if the cache is currently updating itself.
bool |
|
inherited |
Resets the stores, clearing the array of created stores.
Cache objects still held onto by the code that initialised them will remain as is however all future requests for a cache/store will lead to a new instance being re-initialised.
|
inherited |
Updates the state fo the cache API.
int | $state |
bool |
|
inherited |
Returns true if the cache stores have been disabled.
bool |
|
inherited |
Informs the factory that the upgrading has finished.
This forces the state back to ready.
|
inherited |
Informs the factory that the cache is currently updating itself.
This forces the state to upgrading and can only be called once the cache is ready to use. Calling it ensure we don't try to reinstantite things when requesting cache definitions that don't exist yet.