Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.11.x will end 14 Nov 2022 (12 months plus 6 months extension).
  • Bug fixes for security issues in 3.11.x will end 13 Nov 2023 (18 months plus 12 months extension).
  • PHP version: minimum PHP 7.3.0 Note: minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is supported too.

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

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: 531 lines (17 kb)
Included or required:0 times
Referenced: 2 times
Includes or requires: 0 files

Defines 3 classes

cache_disabled:: (11 methods):
  __construct()
  get()
  get_many()
  set()
  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($key, $strictness = IGNORE_MISSING)   X-Ref
Gets a key from the cache.

param: int|string $key
param: int $strictness Unused.
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($key, $data)   X-Ref
Sets a key value pair in the cache.

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

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

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.