Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.2.x will end 22 April 2024 (12 months).
  • Bug fixes for security issues in 4.2.x will end 7 October 2024 (18 months).
  • PHP version: minimum PHP 8.0.0 Note: minimum PHP version has increased since Moodle 4.1. PHP 8.1.x is supported too.

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

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: 608 lines (20 kb)
Included or required:0 times
Referenced: 3 times
Includes or requires: 0 files

Defines 3 classes

cache_disabled:: (14 methods):
  __construct()
  get_implementation()
  get_many()
  set_implementation()
  set_many()
  delete()
  delete_many()
  has()
  has_all()
  has_any()
  purge()
  acquire_lock()
  release_lock()
  check_lock_state()

cache_factory_disabled:: (9 methods):
  instance()
  create_definition()
  create_cache()
  create_cache_from_definition()
  clear_temporary_caches()
  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.

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
return: bool

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

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

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

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

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

param: array $keyvaluearray Unused.
return: int

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

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

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

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

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

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

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

param: array $keys Unused.
return: bool

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

param: array $keys Unused.
return: bool

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

return: bool

acquire_lock($key)   X-Ref
Pretend that we got a lock to avoid errors.

param: int|string $key
return: bool

release_lock($key)   X-Ref
Pretend that we released a lock to avoid errors.

param: int|string $key
return: bool

check_lock_state($key)   X-Ref
Pretend that we have a lock to avoid errors.

param: int|string $key
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.

param: bool $forcereload Unused.
return: cache_factory

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

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

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

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

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

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.
return: cache_application|cache_session|cache_request

clear_temporary_caches()   X-Ref
Removes all temporary caches.

Don't call this directly - used by {@see \core_cache\allow_temporary_caches}.

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

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

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

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

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

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

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.

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

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

param: array $modemappings Unused.
return: bool

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

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

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

param: string $name Unused.
return: bool

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

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

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.

param: bool $coreonly Unused.
return: array

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

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