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 39 and 400] [Versions 400 and 401] [Versions 400 and 402] [Versions 400 and 403]

This file contains classes that are used by the Cache API only when it is disabled. These classes are derivatives of other significant classes used by the Cache API customised specifically to only do what is absolutely necessary when initialising and using the Cache API when its been disabled.

Copyright: 2012 Sam Hemelryk
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 546 lines (18 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 3 classes

cache_disabled:: (11 methods):
  __construct()
  get_implementation()
  get_many()
  set_implementation()
  set_many()
  delete()
  delete_many()
  has()
  has_all()
  has_any()
  purge()

cache_factory_disabled:: (8 methods):
  instance()
  create_definition()
  create_cache()
  create_cache_from_definition()
  create_cache_from_params()
  create_store_from_config()
  create_config_instance()
  is_disabled()

cache_config_disabled:: (11 methods):
  instance()
  config_save()
  generate_configuration_array()
  add_store_instance()
  set_mode_mappings()
  edit_store_instance()
  delete_store_instance()
  create_default_configuration()
  update_definitions()
  locate_definitions()
  set_definition_mappings()


Class: cache_disabled  - X-Ref

The cache loader class used when the Cache has been disabled.

__construct(cache_definition $definition, cache_store $store, $loader = null)   X-Ref
Constructs the cache.

param: cache_definition $definition
param: cache_store $store
param: null $loader Unused.

get_implementation($key, int $requiredversion, int $strictness, &$actualversion = null)   X-Ref
Gets a key from the cache.

return: bool
param: int|string $key
param: int $requiredversion Minimum required version of the data or cache::VERSION_NONE
param: int $strictness Unused.
param: mixed &$actualversion If specified, will be set to the actual version number retrieved

get_many(array $keys, $strictness = IGNORE_MISSING)   X-Ref
Gets many keys at once from the cache.

return: array
param: array $keys
param: int $strictness Unused.

set_implementation($key, int $version, $data, bool $setparents = true)   X-Ref
Sets a key value pair in the cache.

return: bool
param: int|string $key Unused.
param: int $version Unused.
param: mixed $data Unused.
param: bool $setparents Unused.

set_many(array $keyvaluearray)   X-Ref
Sets many key value pairs in the cache at once.

return: int
param: array $keyvaluearray Unused.

delete($key, $recurse = true)   X-Ref
Deletes an item from the cache.

return: bool
param: int|string $key Unused.
param: bool $recurse Unused.

delete_many(array $keys, $recurse = true)   X-Ref
Deletes many items at once from the cache.

return: int
param: array $keys Unused.
param: bool $recurse Unused.

has($key, $tryloadifpossible = false)   X-Ref
Checks if the cache has the requested key.

return: bool
param: int|string $key Unused.
param: bool $tryloadifpossible Unused.

has_all(array $keys)   X-Ref
Checks if the cache has all of the requested keys.

return: bool
param: array $keys Unused.

has_any(array $keys)   X-Ref
Checks if the cache has any of the requested keys.

return: bool
param: array $keys Unused.

purge()   X-Ref
Purges all items from the cache.

return: bool

Class: cache_factory_disabled  - X-Ref

The cache factory class used when the Cache has been disabled.

instance($forcereload = false)   X-Ref
Returns an instance of the cache_factor method.

return: cache_factory
param: bool $forcereload Unused.

create_definition($component, $area, $unused = null)   X-Ref
Creates a definition instance or returns the existing one if it has already been created.

return: cache_definition
param: string $component
param: string $area
param: string $unused Used to be datasourceaggregate but that was removed and this is now unused.

create_cache(cache_definition $definition)   X-Ref
Common public method to create a cache instance given a definition.

return: cache_application|cache_session|cache_store
param: cache_definition $definition

create_cache_from_definition($component, $area, array $identifiers = array()   X-Ref
Creates a cache object given the parameters for a definition.

return: cache_application|cache_session|cache_request
param: string $component
param: string $area
param: array $identifiers
param: string $unused Used to be datasourceaggregate but that was removed and this is now unused.

create_cache_from_params($mode, $component, $area, array $identifiers = array()   X-Ref
Creates an ad-hoc cache from the given param.

return: cache_application|cache_session|cache_request
param: int $mode
param: string $component
param: string $area
param: array $identifiers
param: array $options An array of options, available options are:

create_store_from_config($name, array $details, cache_definition $definition)   X-Ref
Creates a store instance given its name and configuration.

return: boolean|cache_store
param: string $name Unused.
param: array $details Unused.
param: cache_definition $definition

create_config_instance($writer = false)   X-Ref
Creates a cache config instance with the ability to write if required.

return: cache_config_disabled|cache_config_writer
param: bool $writer Unused.

is_disabled()   X-Ref
Returns true if the cache API has been disabled.

return: bool

Class: cache_config_disabled  - X-Ref

The cache config class used when the Cache has been disabled.

instance()   X-Ref
Returns an instance of the configuration writer.

return: cache_config_disabled

config_save()   X-Ref
Saves the current configuration.


generate_configuration_array()   X-Ref
Generates a configuration array suitable to be written to the config file.

return: array

add_store_instance($name, $plugin, array $configuration = array()   X-Ref
Adds a plugin instance.

return: bool
param: string $name Unused.
param: string $plugin Unused.
param: array $configuration Unused.

set_mode_mappings(array $modemappings)   X-Ref
Sets the mode mappings.

return: bool
param: array $modemappings Unused.

edit_store_instance($name, $plugin, $configuration)   X-Ref
Edits a give plugin instance.

return: bool
param: string $name Unused.
param: string $plugin Unused.
param: array $configuration Unused.

delete_store_instance($name)   X-Ref
Deletes a store instance.

return: bool
param: string $name Unused.

create_default_configuration($forcesave = false)   X-Ref
Creates the default configuration and saves it.

return: array
param: bool $forcesave Ignored because we are disabled!

update_definitions($coreonly = false)   X-Ref
Updates the definition in the configuration from those found in the cache files.

param: bool $coreonly Unused.

locate_definitions($coreonly = false)   X-Ref
Locates all of the definition files.

return: array
param: bool $coreonly Unused.

set_definition_mappings($definition, $mappings)   X-Ref
Sets the mappings for a given definition.

param: string $definition Unused.
param: array $mappings Unused.