mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 17:06:53 +02:00
Merge branch 'wip-MDL-36362-m24' of git://github.com/samhemelryk/moodle
Conflicts: version.php
This commit is contained in:
commit
2c36da50bc
5 changed files with 32 additions and 3 deletions
2
cache/README.md
vendored
2
cache/README.md
vendored
|
@ -9,6 +9,7 @@ A definition:
|
||||||
$definitions = array(
|
$definitions = array(
|
||||||
'string' => array( // Required, unique to the component
|
'string' => array( // Required, unique to the component
|
||||||
'mode' => cache_store::MODE_APPLICATION, // Required
|
'mode' => cache_store::MODE_APPLICATION, // Required
|
||||||
|
'simpledata' => false, // Optional
|
||||||
'requireidentifiers' => array( // Optional
|
'requireidentifiers' => array( // Optional
|
||||||
'lang'
|
'lang'
|
||||||
),
|
),
|
||||||
|
@ -104,6 +105,7 @@ The following settings are required for a definition:
|
||||||
* mode - Application, session or request.
|
* mode - Application, session or request.
|
||||||
|
|
||||||
The following optional settings can also be defined:
|
The following optional settings can also be defined:
|
||||||
|
* simpledata - Set to true if you know that you will only be storing scalar values or arrays of scalar values. Avoids costly investigation of data types.
|
||||||
* requireidentifiers - Any identifiers the definition requires. Must be provided when creating the loader.
|
* requireidentifiers - Any identifiers the definition requires. Must be provided when creating the loader.
|
||||||
* requiredataguarantee - If set to true then only stores that support data guarantee will be used.
|
* requiredataguarantee - If set to true then only stores that support data guarantee will be used.
|
||||||
* requiremultipleidentifiers - If set to true then only stores that support multiple identifiers will be used.
|
* requiremultipleidentifiers - If set to true then only stores that support multiple identifiers will be used.
|
||||||
|
|
21
cache/classes/definition.php
vendored
21
cache/classes/definition.php
vendored
|
@ -39,6 +39,8 @@ defined('MOODLE_INTERNAL') || die();
|
||||||
* [int] Sets the mode for the definition. Must be one of cache_store::MODE_*
|
* [int] Sets the mode for the definition. Must be one of cache_store::MODE_*
|
||||||
*
|
*
|
||||||
* Optional settings:
|
* Optional settings:
|
||||||
|
* + simpledata
|
||||||
|
* [bool] If set to true we know that the data is scalar or array of scalar.
|
||||||
* + requireidentifiers
|
* + requireidentifiers
|
||||||
* [array] An array of identifiers that must be provided to the cache when it is created.
|
* [array] An array of identifiers that must be provided to the cache when it is created.
|
||||||
* + requiredataguarantee
|
* + requiredataguarantee
|
||||||
|
@ -127,6 +129,12 @@ class cache_definition {
|
||||||
*/
|
*/
|
||||||
protected $area;
|
protected $area;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set to true if we know the data is scalar or array of scalar.
|
||||||
|
* @var bool
|
||||||
|
*/
|
||||||
|
protected $simpledata = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An array of identifiers that must be provided when the definition is used to create a cache.
|
* An array of identifiers that must be provided when the definition is used to create a cache.
|
||||||
* @var array
|
* @var array
|
||||||
|
@ -281,6 +289,7 @@ class cache_definition {
|
||||||
$area = (string)$definition['area'];
|
$area = (string)$definition['area'];
|
||||||
|
|
||||||
// Set the defaults.
|
// Set the defaults.
|
||||||
|
$simpledata = false;
|
||||||
$requireidentifiers = array();
|
$requireidentifiers = array();
|
||||||
$requiredataguarantee = false;
|
$requiredataguarantee = false;
|
||||||
$requiremultipleidentifiers = false;
|
$requiremultipleidentifiers = false;
|
||||||
|
@ -297,6 +306,9 @@ class cache_definition {
|
||||||
$mappingsonly = false;
|
$mappingsonly = false;
|
||||||
$invalidationevents = array();
|
$invalidationevents = array();
|
||||||
|
|
||||||
|
if (array_key_exists('simpledata', $definition)) {
|
||||||
|
$simpledata = (bool)$definition['simpledata'];
|
||||||
|
}
|
||||||
if (array_key_exists('requireidentifiers', $definition)) {
|
if (array_key_exists('requireidentifiers', $definition)) {
|
||||||
$requireidentifiers = (array)$definition['requireidentifiers'];
|
$requireidentifiers = (array)$definition['requireidentifiers'];
|
||||||
}
|
}
|
||||||
|
@ -398,6 +410,7 @@ class cache_definition {
|
||||||
$cachedefinition->mode = $mode;
|
$cachedefinition->mode = $mode;
|
||||||
$cachedefinition->component = $component;
|
$cachedefinition->component = $component;
|
||||||
$cachedefinition->area = $area;
|
$cachedefinition->area = $area;
|
||||||
|
$cachedefinition->simpledata = $simpledata;
|
||||||
$cachedefinition->requireidentifiers = $requireidentifiers;
|
$cachedefinition->requireidentifiers = $requireidentifiers;
|
||||||
$cachedefinition->requiredataguarantee = $requiredataguarantee;
|
$cachedefinition->requiredataguarantee = $requiredataguarantee;
|
||||||
$cachedefinition->requiremultipleidentifiers = $requiremultipleidentifiers;
|
$cachedefinition->requiremultipleidentifiers = $requiremultipleidentifiers;
|
||||||
|
@ -534,6 +547,14 @@ class cache_definition {
|
||||||
return $this->mappingsonly;
|
return $this->mappingsonly;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns true if the data is known to be scalar or array of scalar.
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function uses_simple_data() {
|
||||||
|
return $this->simpledata;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if this definition requires a data guarantee from the cache stores being used.
|
* Returns true if this definition requires a data guarantee from the cache stores being used.
|
||||||
* @return bool
|
* @return bool
|
||||||
|
|
3
cache/classes/loaders.php
vendored
3
cache/classes/loaders.php
vendored
|
@ -498,6 +498,9 @@ class cache implements cache_loader {
|
||||||
* @param stdClass|array $data
|
* @param stdClass|array $data
|
||||||
*/
|
*/
|
||||||
protected function unref($data) {
|
protected function unref($data) {
|
||||||
|
if ($this->definition->uses_simple_data()) {
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
// Check if it requires serialisation in order to produce a reference free copy.
|
// Check if it requires serialisation in order to produce a reference free copy.
|
||||||
if ($this->requires_serialisation($data)) {
|
if ($this->requires_serialisation($data)) {
|
||||||
// Damn, its going to have to be serialise.
|
// Damn, its going to have to be serialise.
|
||||||
|
|
|
@ -31,6 +31,7 @@ $definitions = array(
|
||||||
// Used to store processed lang files.
|
// Used to store processed lang files.
|
||||||
'string' => array(
|
'string' => array(
|
||||||
'mode' => cache_store::MODE_APPLICATION,
|
'mode' => cache_store::MODE_APPLICATION,
|
||||||
|
'simpledata' => true,
|
||||||
'persistent' => true,
|
'persistent' => true,
|
||||||
'persistentmaxsize' => 3
|
'persistentmaxsize' => 3
|
||||||
),
|
),
|
||||||
|
@ -48,14 +49,16 @@ $definitions = array(
|
||||||
// Used to store data from the config + config_plugins table in the database.
|
// Used to store data from the config + config_plugins table in the database.
|
||||||
'config' => array(
|
'config' => array(
|
||||||
'mode' => cache_store::MODE_APPLICATION,
|
'mode' => cache_store::MODE_APPLICATION,
|
||||||
'persistent' => true
|
'persistent' => true,
|
||||||
|
'simpledata' => true
|
||||||
),
|
),
|
||||||
|
|
||||||
// Event invalidation cache.
|
// Event invalidation cache.
|
||||||
'eventinvalidation' => array(
|
'eventinvalidation' => array(
|
||||||
'mode' => cache_store::MODE_APPLICATION,
|
'mode' => cache_store::MODE_APPLICATION,
|
||||||
'persistent' => true,
|
'persistent' => true,
|
||||||
'requiredataguarantee' => true
|
'requiredataguarantee' => true,
|
||||||
|
'simpledata' => true,
|
||||||
),
|
),
|
||||||
|
|
||||||
// Cache for question definitions. This is used by the question_bank class.
|
// Cache for question definitions. This is used by the question_bank class.
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
defined('MOODLE_INTERNAL') || die();
|
defined('MOODLE_INTERNAL') || die();
|
||||||
|
|
||||||
|
|
||||||
$version = 2012110201.02; // YYYYMMDD = weekly release date of this DEV branch
|
$version = 2012110600.00; // YYYYMMDD = weekly release date of this DEV branch
|
||||||
// RR = release increments - 00 in DEV branches
|
// RR = release increments - 00 in DEV branches
|
||||||
// .XX = incremental changes
|
// .XX = incremental changes
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue